I have .ps1 script which should return me SID of current user (or administrator). But i have no idea how can i get this value from that script into my C# code. Can somebody help me, please?
Currently i am calling one script in this way:
ProcessStartInfo newProcessInfo = new ProcessStartInfo();
newProcessInfo.FileName = @"C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe";
newProcessInfo.Verb = "runas";
newProcessInfo.Arguments = @"sfc /scannow";
Process.Start(newProcessInfo);
newProcessInfo.Arguments = @"-Command ""sfc /scannow""";
newProcessInfo.Arguments = @"–ExecutionPolicy Bypass -File ""c:\\Users\\HP\\Desktop\\HotelMode-PB\\HotelMode.ps1""";
And i need to get SID of user from another .ps1 script and then use it in this cmd command:
HotelMode.ps1 -UserSid "" [-debug]