Windows サービスをインストールする Win2k8R2 サーバー、Web Edition でプログラムをリモートで開始したいと考えています。
サービスのインストールは、「screen>0」がある場合にのみ可能です。これは、ユーザーがログインする必要があることを意味します(ログインダイアログウィンドウが「screen 0」を表していることをどこかで読みました。ここで間違っている場合は修正してください)。画面を表示するために、RDP 接続を開き、すべてをサイレント インストールする setup exe をトリガーします。
すでに Windows Server 2003 で実行できるようにしました。2008 R2 では動作しなくなりました。私は、私が望むものを達成するための何らかのセキュリティポリシー、またはまったく別の手法さえあると思います。
コードは次のとおりです。
this.axMsRdpClient7 = new AxMSTSCLib.AxMsRdpClient7();
// ... some GUI stuff happens here..
axMsRdpClient7.Server = hostname;
axMsRdpClient7.UserName = username;
axMsRdpClient7.AdvancedSettings.Compress = -1;
axMsRdpClient7.AdvancedSettings2.DisplayConnectionBar = true;
axMsRdpClient7.AdvancedSettings7.ClearTextPassword = userpassword;
axMsRdpClient7.AdvancedSettings2.EncryptionEnabled = -1;
// Set start program information. vvv THIS IS NOT GOING TO BE EXECUTED vvv
axMsRdpClient7.SecuredSettings.StartProgram = executablePath + " " + arguments;
axMsRdpClient7.SecuredSettings.WorkDir = workingDirectory;
// ... here I'm attaching some events like OnDisconnect...
// Start connection
axMsRdpClient7.Connect();
// Now the startprogram should be executed, but doesn't.
// (at this time its ok that I have to manually log off to reach disconnect. Except you have a better idea to disconnect after startprogram finishes)
while (axMsRdpClient7.Connected != 0)
{
Application.DoEvents();
Thread.Sleep(1);
}
// End connection
axMsRdpClient7.Disconnect();
StartProgram が実行されていない理由を知っている人はいますか? エラーはありません。起動しないだけです。
または、サービスをリモートでインストールするためのより良い方法を知っている人はいますか?
前もって感謝します!