Add Powershell/trustedhosts.ps1
This commit is contained in:
11
Powershell/trustedhosts.ps1
Normal file
11
Powershell/trustedhosts.ps1
Normal 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
|
||||
Reference in New Issue
Block a user