My codes runs perfectly when i run it as Admin. but it gave an error when i run it as guest:
An internal error occurred.
Is there any way i can configure to run power shell as Admin programmatic?
string shellUri = "http://schemas.microsoft.com/powershell/Microsoft.PowerShell";
string password = "****";
System.Security.SecureString securePW = new System.Security.SecureString();
foreach (char c in password)
securePW.AppendChar(c);
securePW.MakeReadOnly();
string domainAndUsername = @"192.168.1.113\***";
string remoteMachineName = "****";
PSCredential remoteCredential = new PSCredential(domainAndUsername, securePW);
WSManConnectionInfo connectionInfo = new WSManConnectionInfo(false, remoteMachineName, 5985, "/wsman", shellUri, remoteCredential);
using (Runspace runspace = RunspaceFactory.CreateRunspace(connectionInfo)) //_Error Here_//
I found some solutions but they are OLD, they don't work anymore :S