Last active
September 16, 2023 17:57
-
-
Save JasonMorgan/c7f9753d404825035adc to your computer and use it in GitHub Desktop.
Setting and modifying Trusted Hosts with PowerShell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Hey folks, this is just a quick walkthrough on modifying the trusted hosts property in WSMAN using Powershell | |
# By default PowerShell loads a PSDrive for the WinRM service | |
# We modify the trusted hosts property using the Set-Item cmdlet | |
Set-Item WSMan:\localhost\Client\TrustedHosts -value 192.168.1.13 | |
#This sets the value to 192.168.1.13, it also overwrites any existing values | |
# If you want to set a subnet you can use the PowerShell wildcard character | |
Set-Item WSMan:\localhost\Client\TrustedHosts -value 192.168.1.* | |
# both the examples above will overwrite the current value of the trustedhosts property | |
# to add to instead of overwriting you need to use the concatenate dynamic parameter available in the WSMAN provider | |
# Thanks to @alexandair for that bit of info | |
set-item WSMan:\localhost\Client\TrustedHosts -Value "192.168.0.*" -Concatenate | |
# | |
# and that's all I have! I hope this was useful to someone |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment