winrm quickconfigConfigures the WinRM service with default settings and enables the firewall exception.
Windows Remote Management from Linux and PowerShell: Enter-PSSession, Invoke-Command and service configuration.
Test-WSMan -ComputerName 192.168.1.10Verifies that the WinRM service is accessible and listening on a remote target.
Test-WSMan -ComputerName 192.168.1.10 -Port 5985Tests WinRM connectivity on a specific HTTP port.
Test-WSMan -ComputerName 192.168.1.10 -Port 5986 -UseSSLTests WinRM connectivity over HTTPS using the default secure port.
winrm enumerate winrm/config/listenerLists all configured WinRM listeners and their specific settings.
winrm create winrm/config/Listener?Address=*+Transport=HTTPCreates a new listener that accepts HTTP connections on all network interfaces.
winrm create winrm/config/Listener?Address=*+Transport=HTTPS @{Hostname="server.domain.com";CertificateThumbprint="THUMBPRINT_GOES_HERE"}Creates a secure HTTPS listener bound to a specific certificate thumbprint.
Example
winrm create winrm/config/Listener?Address=*+Transport=HTTPS @{Hostname="server.domain.com";CertificateThumbprint="A1B2C3D4E5F6..."}Set-Item WSMan:\localhost\Client\TrustedHosts -Value "192.168.1.10"Adds a specific IP address to the TrustedHosts list to allow unauthenticated connection establishment.
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "*" -ForceConfigures the client to trust all hosts, often used in lab environments for testing.
Get-Item WSMan:\localhost\Client\TrustedHostsDisplays the current list of trusted hosts configured on the client.
winrm set winrm/config/service @{AllowUnencrypted="true"}Enables the service to accept unencrypted traffic, typically for debugging or legacy support.
winrm set winrm/config/service/auth @{Basic="true"}Enables Basic authentication on the service, allowing plain text credentials over the connection.
Enter-PSSession -ComputerName 192.168.1.10 -Credential (Get-Credential)Starts an interactive PowerShell session on the remote computer using prompted credentials.
Enter-PSSession -ComputerName 192.168.1.10 -Authentication NegotiateConnects using Negotiate authentication, which attempts Kerberos and falls back to NTLM.
Enter-PSSession -ComputerName 192.168.1.10 -Authentication KerberosForces Kerberos authentication, requiring correct SPNs and domain trust.
Invoke-Command -ComputerName 192.168.1.10 -ScriptBlock { Get-Process }Executes a PowerShell script block on the remote machine and returns objects to the local session.
Invoke-Command -ComputerName 192.168.1.10 -FilePath .\script.ps1Reads a local PowerShell script file and executes its contents on the remote system.
Invoke-Command -ComputerName 192.168.1.10 -ScriptBlock { param($p) Write-Host $p } -ArgumentList "Hello"Passes local arguments into the remote script block for dynamic execution.
$s = New-PSSession -ComputerName 192.168.1.10 -Credential (Get-Credential)Creates a persistent PowerShell session object stored in a variable for reuse.
Invoke-Command -Session $s -ScriptBlock { hostname }Executes a command inside an existing persistent session without re-authenticating.
Get-PSSessionLists all active PowerShell sessions maintained by the local client.
Remove-PSSession -Session $sCloses the specified persistent session and frees resources.
Disconnect-PSSession -Id 1Disconnects a session but leaves it running on the remote host for later reconnection.
Connect-PSSession -ComputerName 192.168.1.10 -Id 1Reconnects to a previously disconnected session on a remote machine.
Invoke-Command -ComputerName 192.168.1.10 -Authentication Credssp -Credential (Get-Credential) -ScriptBlock { Get-Service }Uses CredSSP authentication to allow the remote host to delegate the user's credentials to a second hop.
Invoke-Command -ComputerName 192.168.1.10 -ScriptBlock { Start-Process powershell -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File C:\payload.ps1' }Remotely triggers a payload execution using Start-Process to detach from the WinRM shell.
Invoke-Command -ComputerName 192.168.1.10 -AsJob -ScriptBlock { 1..100 | ForEach-Object { Start-Sleep 1; $_ } }Runs a long-running process as a background job on the remote host to avoid hanging the console.
Receive-Job -Id 1 -KeepRetrieves the output from a background remote job while keeping the data available for future retrieval.
Invoke-Command -ComputerName 192.168.1.10 -ScriptBlock { whoami /priv }Checks the privilege level of the current remote session to validate successful elevation.
Invoke-Command -ComputerName 192.168.1.10 -ScriptBlock { Get-MpComputerStatus }Remotely queries Windows Defender status to check for exclusions or real-time protection state.
Get-WinEvent -LogName "Microsoft-Windows-WinRM/Operational" -MaxEvents 10Queries local WinRM operational logs to detect recent incoming connections and errors.
Invoke-Command -ComputerName 192.168.1.10 -ScriptBlock { Get-WinEvent -LogName 'Security' -FilterXPath "*[System[EventID=4624] and EventData[Data[@Name='LogonType']='3']]" }Remotely searches Security logs for Network Logon (Type 3) events associated with WinRM activity.
Invoke-Command -ComputerName 192.168.1.10 -ScriptBlock { Get-NetTCPConnection | Where-Object { $_.LocalPort -eq 5985 } }Identifies active TCP connections on the remote host specifically on the WinRM HTTP port.
Disable-PSRemoting -ForceRapidly disables PowerShell Remoting on the system to stop active lateral movement.
New-PSSessionConfigurationFile -Path .\JEAConfig.pssc -SessionType RestrictedRemoteServerCreates a Just Enough Administration (JEA) configuration file to restrict remote capabilities.
Register-PSSessionConfiguration -Name "Maintenance" -Path .\JEAConfig.psscRegisters a new endpoint on the local machine using the restricted JEA configuration.
Enter-PSSession -ComputerName 192.168.1.10 -ConfigurationName "Maintenance"Connects to a specific named endpoint (JEA) rather than the default PowerShell endpoint.
Invoke-Command -ComputerName (Get-Content servers.txt) -ScriptBlock { Update-Help } -ThrottleLimit 10Runs a command against a list of servers read from a file, limiting concurrent operations to 10.
Remove-Item WSMan:\localhost\Listener\* -RecurseDeletes all configured WinRM listeners, effectively stopping the machine from accepting connections.
winrm invoke Restore winrm/configResets the WinRM configuration to its default installation state.
Stop-Service WinRMImmediately stops the Windows Remote Management service, terminating all active connections.
winrm identify -r:http://192.168.1.10:5985Queries the remote machine for OS version and WinRM protocol version without a full login.
winrm set winrm/config/client @{NetworkDelayms="60000"}Adjusts the network delay timeout for the client, useful for slow or high-latency connections.
Invoke-Command -ComputerName 192.168.1.10 -ScriptBlock { Get-Service } | Select-Object -Property PSComputerName, Name, StatusFilters and formats object-based output returned from the remote session.
Invoke-Command -ComputerName 192.168.1.10 -ScriptBlock { $env:COMPUTERNAME } -HideComputerNameExecutes remotely but suppresses the 'PSComputerName' property from the output display.
Set-Item WSMan:\localhost\Service\EnableCompatibilityHttpListener -Value $trueEnables the compatibility listener to support legacy WinRM clients or specific port forwarding scenarios.
Set-PSSessionConfiguration -Name Microsoft.PowerShell -ShowSecurityDescriptorUIOpens a GUI to interactively modify the Access Control List (ACL) for the default PowerShell endpoint.
Get-WSManInstance -ResourceURI wmicimv2/cim_service -SelectorSet @{Name="WinRM"} -ComputerName 192.168.1.10Uses WS-Management protocol to directly query the CIM service status on a remote host.
$sessions = New-PSSession -ComputerName (Get-Content hosts.txt); Invoke-Command -Session $sessions -ScriptBlock { gpupdate /force }Establishes persistent sessions to multiple hosts listed in a file and runs a group policy update on all.
The go-to WinRM shell for penetration testers: upload and download files, load PowerShell scripts and pass the hash.
Running commands on remote Windows hosts via the Service Control Manager — Sysinternals PsExec and Impacket’s psexec.py.
Connecting to Windows Remote Desktop from Linux with xfreerdp and rdesktop — including pass-the-hash, drive sharing and clipboard.
OpenSSH: secure remote login, key management, file transfer and port forwarding — local, remote and dynamic SOCKS tunnels.