0

how can i use compmgmnt.msc to remote host using c#. i found this...

execute this command in "cmd.exe" it is working and ask you for The password:

/user:administrator \"mmc.exe compmgmt.msc /computer:IZADI-PC\

but i need to know how can i use this command in c#. i also need to pass the password to this command using c#. i have username and password of the remote computer and i wanna do everything programatically.

I also visited :

http://www.lansweeper.com/forum/yaf_postst5116_Runas-Custom-Actions.aspx Process.Start with different credentials with UAC on

Thank you in advanced!!!

anyone write sample code to excecute /user:administrator \"mmc.exe compmgmt.msc /computer:IZADI-PC\ in c#

Community
  • 1
  • 1
MAYSAM GAMINI
  • 49
  • 1
  • 3
  • 11

1 Answers1

0
ProcessStartInfo startInfo = new ProcessStartInfo();
                Process myprocess = new Process();
                myprocess.StartInfo.CreateNoWindow = true;
                myprocess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                myprocess.StartInfo.UseShellExecute = false;
                myprocess.StartInfo.Verb = "runas";
                myprocess.StartInfo.FileName = "cmd.exe";
                myprocess.StartInfo.UserName = "administrator";
                myprocess.StartInfo.Password = MakeSecureString("123456");
                myprocess.StartInfo.Arguments = "/k mmc.exe compmgmt.msc /computer:PC135-PC";
                myprocess.Start();
                myprocess.Close();
MAYSAM GAMINI
  • 49
  • 1
  • 3
  • 11