Add Powershell/trustedhosts.ps1

This commit is contained in:
2025-05-30 00:49:07 +00:00
parent 80a3c501be
commit 9e32e58cc0

View File

@@ -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