Created
April 7, 2021 15:35
-
-
Save steviecoaster/56ea6a358947c59996ba24778e773400 to your computer and use it in GitHub Desktop.
Quickly setup PSRemoting on Non-domain bound endpoints
This file contains hidden or 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
[CmdletBinding()] | |
Param( | |
[Parameter(Mandatory)] | |
[String[]] | |
$TrustedHosts | |
) | |
begin { | |
if(-not (Test-WSMan)){ | |
Enable-PSRemoting -Force | |
} | |
} | |
process { | |
Get-NetConnectionProfile | Set-NetConnectionProfile -NetworkCategory Private | |
$winrmArgs = @('set','winrm/config/client',"'{TrustedHosts=`"$($TrustedHosts -join ',')`"}'") | |
& winrm @winrmArgs | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment