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);
                    WSManConnectionInfo connectionInfo = new WSManConnectionInfo(ExchangeUri, "", credentials);
                    connectionInfo.AuthenticationMechanism = AuthenticationMechanism.Basic;
                    Runspace runspace = RunspaceFactory.CreateRunspace(connectionInfo);

    2017年2月9日 3:35