Skip to content

Instantly share code, notes, and snippets.

@kdemanuele
Created December 30, 2016 09:49
Show Gist options
  • Save kdemanuele/0568e1422bf21ad3936dc9acd8d341ed to your computer and use it in GitHub Desktop.
Save kdemanuele/0568e1422bf21ad3936dc9acd8d341ed to your computer and use it in GitHub Desktop.
Easy steps to enable Powershell Remoting
### Enable PSRemoting on Source Machine
# Enable the PSRemoting on all interfaces even the Public Network Interfaces
Enable-PSRemoting -Force -SkipNetworkProfileCheck -Verbose
# Allow only remote access from specific computers
Set-Item WSMan:\localhost\Client\TrustedHosts -Value '[List of IPs or Computer Names to where commands will be sent]'
# Restart the WinRM service
Restart-Service WinRM
### Enable PSRemoting on Target Machine
# Enable the PSRemoting on all interfaces even the Public Network Interfaces
Enable-PSRemoting -Force -SkipNetworkProfileCheck -Verbose
# Allow only remote access from specific computers
Set-Item WSMan:\localhost\Client\TrustedHosts -Value '[List of IPs or Computer Names from where commands originate]'
# If the remote commands are sent from computers not on the same workgroup, open the WinRM Public interface in the firewall
Set-NetFirewallRule –Name "WINRM-HTTP-In-TCP-PUBLIC" –RemoteAddress Any
# Configure the machine to accept remote commands
Set-WSManQuickConfig
# Restart the WinRM service
Restart-Service WinRM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment