Run Enable-Mailbox query remotely

  • Thread starter Thread starter Abhinav9393
  • Start date Start date
A

Abhinav9393

Guest
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)), "http://schemas.microsoft.com/powershell/Microsoft.Exchange", 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

Continue reading...
 
Back
Top