I prefer to work with the PSDrive WSMan:
.
Get TrustedHosts
Get-Item WSMan:localhostClientTrustedHosts
Set TrustedHosts
provide a single, comma-separated, string of computer names
Set-Item WSMan:localhostClientTrustedHosts -Value 'machineA,machineB'
or (dangerous) a wild-card
Set-Item WSMan:localhostClientTrustedHosts -Value '*'
to append to the list, the -Concatenate
parameter can be used
Set-Item WSMan:localhostClientTrustedHosts -Value 'machineC' -Concatenate
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…