如何使用c#对远程主机使用compmgmnt.msc?我发现了这个..。
在"cmd.exe“中执行此命令,它正在工作,并要求您提供密码:
/user:administrator \"mmc.exe compmgmt.msc /computer:IZADI-PC\但我需要知道如何在c#中使用此命令。我还需要使用c#将密码传递给此命令。我有远程计算机的用户名和密码,我想用程序来做所有的事情。
我还访问了:
http://www.lansweeper.com/forum/yaf_postst5116_Runas-Custom-Actions.aspx Process.Start with different credentials with UAC on
感谢您的高考!
任何人都可以在c#中编写示例代码来执行/user:administrator \"mmc.exe compmgmt.msc /computer:IZADI-PC\
发布于 2012-10-29 15:54:26
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();https://stackoverflow.com/questions/13107712
复制相似问题