none
System.Management.Automation error access denied RRS feed

  • 问题

  • System.Management.Automation class I use the c # PowerShell exchange programs that access the server, increase the tasks of e-mail accounts, a program error access denied;

     PSCredential credentials = new PSCredential(UserName, ssRunasPassword);
                  //ExchangeUri=ExUri
                    WSManConnectionInfo connectionInfo = new WSManConnectionInfo(ExchangeUri, "http://schemas.microsoft.com/powershell/Microsoft.Exchange", credentials);
                    connectionInfo.AuthenticationMechanism = AuthenticationMechanism.Basic;
    
                    Runspace runspace = RunspaceFactory.CreateRunspace(connectionInfo);
                    runspace.Open();

    2017年2月9日 3:35