Hello
I tried this on my local laptop, it works:
Code:
var con = new WSManConnectionInfo();
con.Credential = new PSCredential("user", "pass".ToSecureString());
Runspace runspace = RunspaceFactory.CreateRunspace(con);
runspace.Open();
Pipeline pipeline = runspace.CreatePipeline();
pipeline.Commands.Add("dir");
pipeline.Commands.Add("Out-String");
var results = pipeline.Invoke();
runspace.Close();
to connect to a remote machine you need to specify the machine to the WSManConnectionInfo
also make sure you enable PowerShell remoting : http://www.howtogeek.com/117192/how-...ote-computers/