Run Enable-Mailbox query remotely


  • Hi,

    I have installed exchange management tool in my system and i am using Enable-Mailbox query for enable the user mail property. I am using remote login for using this query.

    Sample code for login:

    string ConnectionUri = http://SERVERNAME/powershell?serializationLevel=Full; string sPassword = TextBoxExchangePassword.Text; SecureString sSPassword = new SecureString(); foreach (char X in sPassword) sSPassword.AppendChar(X); PSCredential Credential = new PSCredential(TextBoxExchangeUser.Text, sSPassword); // Set the connection info WSManConnectionInfo ConInfo = new WSManConnectionInfo((new Uri(ConnectionUri)), "", Credential); ConInfo.AuthenticationMechanism = AuthenticationMechanism.Kerberos;

                ConInfo.SkipCACheck = true;
                ConInfo.SkipCNCheck = true;

    return ConInfo;

    this is my code for login to remote of exchange 2007 but it fails and gives an error :

    Connecting to remote server failed with the following error message : The WinRM client received an HTTP status code of 403 from the remote WS-Management service.

    So can you tell me what i am doing wrong because this method works fine in Exchange 2013. Or there is any other method for doing this.

    Thank you

    • Moved by CoolDadTx Monday, July 2, 2018 1:51 PM Exchange related
    Monday, July 2, 2018 9:47 AM

All replies