Answered by:
Error in Exchange server commands - get mailbox

Question
-
Hello,
I am working with power shell and Exchange server 2010. I was able to get mailbox details using the following command$server='WIN-APRJ2923AV5.abc.com';$pwd= convertto-securestring 'Global123$' -asplaintext -force;$cred=new-object -typename System.Management.Automation.PSCredential -argumentlist 'Administrator',$pwd; invoke-command -computername $server -credential $cred -scriptblock {Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010; get-mailbox xyz}
I have tried this command with IP address instead of Computername....
$server='192.168.1.194';$pwd= convertto-securestring 'Global123$'-asplaintext -force;$cred=new-object -typename System.Management.Automation.PSCredential -argumentlist 'WIN-APRJ2923AV5.abc.com\Administrator',$pwd; invoke-command -computername $server -credential $cred -scriptblock {Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010; get-mailbox xyz}
But it threw an exception as follows
[192.168.1.194] Connecting to remote server failed with the following error message : The WinRM client cannot process the request. Default authentication may be used with an IP address under the following conditions: the transport is HTTPS or the destination is in the TrustedHosts list, and explicit credentials are provided. Use winrm.cmd to configure TrustedHosts. Note that computers in the TrustedHosts list might not be authenticated. For more information on how to set TrustedHosts run the following command: winrm help config. For more information, see the about_Remote_Troubleshooting Help topic. + CategoryInfo : OpenError: (:) [], PSRemotingTransportException + FullyQualifiedErrorId : PSSessionStateBroken
What is the problem with second query? Can anyone help me on this?
Regards
Sebastian
- Edited by sxavier007 Thursday, May 10, 2012 1:10 PM
Thursday, May 10, 2012 1:07 PM
Answers
-
Hi,
Thanks for your reply. At last I got some idea on it from the below URL.
http://powershell.com/cs/forums/p/9900/16486.aspx#16486
Actually I have tried it after entering into power-shell session. Is this the correct method? Is it necessary to enter into power-shell session to execute exchange server commands (in Power-shell console & in C#). Or is there any better method. Please advice.
Regards
Sebastian- Edited by sxavier007 Monday, May 14, 2012 9:31 AM
- Marked as answer by Xiu Zhang Monday, May 28, 2012 9:06 AM
Monday, May 14, 2012 9:26 AM
All replies
-
Hi,
Where did you run the above cmdlt? Remote workstation?
Please try to add the remote workstation to the trustedhost.
set-item wsman:localhost\client\trustedhosts
I recommend you to follow the steps in article below:
about_Remote_Troubleshooting
http://technet.microsoft.com/en-us/library/dd347642.aspx
Xiu Zhang
TechNet Community Support
- Edited by Xiu Zhang Friday, May 11, 2012 7:21 AM
Friday, May 11, 2012 7:20 AM -
I have set the remote work station as trusted host(I am running this query from my PC's power shell console ). Now I receive a different error message
Active Directory operation failed on WIN-APRJ2923AV5.abc.com.
The supplied credential for 'ABC\Administrator' onBind operation is invalid. Error Code: 0x31.
+ CategoryInfo : NotSpecified: (:) [], ADInvalidCredentialException
+ FullyQualifiedErrorId : 5D9341CCAny idea on this?
Regards
Sebastian- Edited by sxavier007 Friday, May 11, 2012 9:21 AM
Friday, May 11, 2012 9:15 AM -
-
Hi,
Thanks for your reply. At last I got some idea on it from the below URL.
http://powershell.com/cs/forums/p/9900/16486.aspx#16486
Actually I have tried it after entering into power-shell session. Is this the correct method? Is it necessary to enter into power-shell session to execute exchange server commands (in Power-shell console & in C#). Or is there any better method. Please advice.
Regards
Sebastian- Edited by sxavier007 Monday, May 14, 2012 9:31 AM
- Marked as answer by Xiu Zhang Monday, May 28, 2012 9:06 AM
Monday, May 14, 2012 9:26 AM -
-
Thank you...Wednesday, May 16, 2012 8:54 AM