diff --git a/Powershell/trustedhosts.ps1 b/Powershell/trustedhosts.ps1 new file mode 100644 index 0000000..5ee8003 --- /dev/null +++ b/Powershell/trustedhosts.ps1 @@ -0,0 +1,11 @@ +# Get current TrustedHosts value +$current = (Get-Item WSMan:\localhost\Client\TrustedHosts).Value + +# Add new host, keeping any existing entries +$new = "$current,192.168.3.166" + +# Remove any accidental double commas or leading/trailing commas +$new = ($new -split ',' | Where-Object { $_ -and $_ -ne '' } | Select-Object -Unique) -join ',' + +# Set TrustedHosts with the combined list +Set-Item WSMan:\localhost\Client\TrustedHosts -Value $new