Please see the following command and with Trusted Hosts enabled, this does not work:

Invoke-Command -ComputerName <IP address> -port 5985 -Credential (New-Object System.Management.Automation.PSCredential ('Domain\User', (ConvertTo-SecureString 'passwd' -AsPlainText -Force))) -Authentication CredSSP -ScriptBlock {Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010;Get-Mailbox}

This works well when Computername is a hostname. The IP address does not works at all

  • Can you post the exact commands you try, and what error you're getting? – Trondh Oct 11 '13 at 10:36
  • Could you post the contents of WSMan:\localhost\Client\TrustedHosts - sanitized of course? – Mathias R. Jessen Oct 11 '13 at 14:47
  • Because Kerberos. – Ryan Ries Sep 28 '15 at 2:47

This is documented in Microsofts information here: http://technet.microsoft.com/library/hh849719.aspx

Essentially you can not use the -computername parameter with an IP without the -credential parameter as well while you can use just the -computername with a hostname.


If you're not bound to PowerShell only commands, just download psexec from Microsoft here: http://technet.microsoft.com/de-ch/sysinternals/bb897553.aspx

This also works for older machines and for batch scripting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.