Configuring WSMan Remotely for multiple computers

When working remotely in a peer-to-peer or cross-domain scenario, you will have to add all the computers you'd like to communicate with into the trusted hosts list. Unfortunately, when you try this, any new entry will overwrite the existing one, so there does not seem to be a way of adding multiple computer names:

Set-Item WSMan:\localhost\client\trustedhosts 10.10.10.10 -force
Set-Item WSMan:\localhost\client\trustedhosts 10.10.10.11 -force
Get-Item WSMan:\localhost\client\trustedhosts

As you see, only the last entry is stored in the list. You should make sure to run PowerShell with full administrative privileges and run Set-WSManQuickConfig beforehand if you cannot run the commands at all because of an access denied-error.

Use the -Concatenate switch to add new entries without overwriting existing entries:

Set-Item WSMan:\localhost\client\trustedhosts `
10.10.10.10 -force -concatenate

Twitter This Tip! ReTweet this Tip!


Posted Nov 23 2009, 08:00 AM by ps1
Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.