Skip to content

Instantly share code, notes, and snippets.

@mark-hallman
Last active March 29, 2023 13:08
Show Gist options
  • Select an option

  • Save mark-hallman/9b4481038e0efa477abf7073445ea4cd to your computer and use it in GitHub Desktop.

Select an option

Save mark-hallman/9b4481038e0efa477abf7073445ea4cd to your computer and use it in GitHub Desktop.
Configure Windows Remoting
# Set network to private
Get-NetConnectionProfile
Set-NetConnectionProfile -InterfaceIndex <index number> -NetworkCategory Private
# To Turn Off Firewall & AV: 
NetSh Advfirewall set allprofiles state off
#Enabling PowerShell Remoting
Enable-PSRemoting -SkipNetworkProfileCheck -Force
Test-WSMan -ComputerName SRV1
# Set start mode to automatic
Set-Service WinRM -StartMode Automatic
# Verify start mode and state - it should be running
Get-WmiObject -Class win32_service | Where-Object {$_.name -like "WinRM"}
# Trust all hosts
Set-Item WSMan:localhost\client\trustedhosts -value *
# Clear list of Trusted Hosts
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "" -Force
# Verify trusted hosts configuration
Get-Item WSMan:\localhost\Client\TrustedHosts
https://4sysops.com/archives/enable-powershell-remoting-on-a-standalone-workgroup-computer/
###############
# Command Examples
###############
# Create session to remote machines and copy folder to that machine
$session = New-PSSession –ComputerName LAB-02
Copy-Item –Path "C:\Tools\kape\*" –Destination 'C:\Tools\kape' -Recurse –ToSession $session
Exit-PSSession
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment