0

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 プロセス。UAC がオンの別の資格情報で開始します。

よろしくお願いします!!!

/user:administrator \"mmc.exe compmgmt.msc /computer:IZADI-PC\誰でもC#で実行するサンプルコードを書く

4

1 に答える 1

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();
于 2012-10-29T07:54:25.517 に答える