You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NB you should add reference to C:\Program Files\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0\System.Management.Automation.dll (this is installed by the Windows SDK).
usingSystem.Management.Automation;
usingSystem.Management.Automation.Runspaces;
usingSystem.Security;
namespaceRunRemoteCommands
{
classProgram
{
staticvoidMain(string[]args)
{
RunScript();
}
// See Installation and Configuration for Windows Remote Management at http://msdn.microsoft.com/en-us/library/windows/desktop/aa384372(v=vs.85).aspx
// See Three ways to configure WinRM listeners. http://blogs.msdn.com/b/wmi/archive/2009/03/17/three-ways-to-configure-winrm-listeners.aspx
// See How to: View Certificates with the MMC Snap-in at http://msdn.microsoft.com/en-us/library/ms788967.aspx
// See MakeCert at http://msdn.microsoft.com/en-us/library/windows/desktop/aa386968(v=vs.85).aspx
// See How to Execute Remote PowerShell Commands using C# at http://scorpiotek.com/blog/?p=770
// See WinRM (Windows Remote Management) Troubleshooting at http://blogs.technet.com/b/jonjor/archive/2009/01/09/winrm-windows-remote-management-troubleshooting.aspx