Windows10 IOT enterprise has a feature to protect write access on drives. This feature is known as UWF "Unified Write Filter". I enable this feature and protect write access on C drive. Now I am looking for a functionality to disable it through my c# code. Cmd command to disable it is "uwfmgr filter disable". I implemented code (below) to execute this command, but its not working
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
startInfo.Arguments = "/C uwfmgr filter disable";
startInfo.UserName = "Administrator";
startInfo.Password = class1.ConvertToSecureString("SRPedm");
process.StartInfo = startInfo;
process.Start();
Process.Start("shutdown","/r /t 0");
The code is executed without giving any error but the command does not execute.
You aren't waiting for the process to finish, and are not looking for any errors.
You need to call
process.WaitForExit
and take a look atprocess.StandardError
See this page for an example https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.process.standarderror?view=netframework-4.8#System_Diagnostics_Process_StandardError