From 9e32e58cc0467dd5539f5e945e2987dd8af1d4af Mon Sep 17 00:00:00 2001 From: DistractADD Date: Fri, 30 May 2025 00:49:07 +0000 Subject: [PATCH] Add Powershell/trustedhosts.ps1 --- Powershell/trustedhosts.ps1 | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Powershell/trustedhosts.ps1 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