Windows Remote Management (WinRM)
MITRE ATT&CK, Lateral Movement, Sub-technique T1021.006
Enabling PowerShell Remoting
In a PowerShell console running as administrator enable PowerShell Remoting:
Enable-PSRemoting –forceSet WinRM start mode to automatic:
Set-Service WinRM -StartMode AutomaticVerify start mode and state:
Get-WmiObject -Class win32_service | Where-Object {$_.name -like "WinRM"}Set Remote Hosts to Trusted
Configure all hosts to be trusted:
Set-Item WSMan:localhost\client\trustedhosts -value *Validate trusted hosts configuration:
Get-Item WSMan:\localhost\Client\TrustedHostsEstablishing a Session
Interactive session using the current user:
Enter-PsSession –ComputerName $hostInteractive session with explicit credentials:
Enter-PsSession –ComputerName $host –Credentials $domain\$userCreate a background session using the current user::
New-PSSession -ComputerName $hostCreate a background session with explicit credentials:
New-PSSession –ComputerName server1.domain.com –Credentials $domain\$userList background sessions:
Get-PSSessionInteracting with a background session:
Enter-PsSession –id $idExiting out of a session:
Exit-PsSessionRemove all background sessions:
Get-PSSession | Disconnect-PSSessionReferences
Last updated


