POWERSHELL REMOTING – THEORY & PRACTICE ROBERT PRÜST
WHO AM
AGENDA Why use PowerShell Remoting? Why use PowerShell Remoting? Enable PowerShell Remoting Enable PowerShell Remoting Using PowerShell Remoting Using PowerShell Remoting
WHY USE POWERSHELL REMOTING What is PowerShell remoting? What is PowerShell remoting? How does it work? How does it work? Why is it important? Why is it important?
WHAT IS POWERSHELL REMOTING
HOW DOES IT WORK
Remote Computer Your Computer PowerShell.exePS_ISEPS Studio HTTP Listener WSMAN [HTTP] WSMAN [HTTP] Windows Remote Management [WinRM] Service PowerShell.exe EndPoint: PowerShell x64 PowerShell.exe EndPoint: PowerShell x86 Whatever EndPoint: Something else
IMPORTANT INFO Web Services for Management (WS-MAN) and Windows Remote Management [WinRM] Web Services for Management (WS-MAN) and Windows Remote Management [WinRM] HTTP [5985, default] HTTPS [5986] HTTP [5985, default] HTTPS [5986] Serialize objects output to XML on remote machine, deserialize XML back to objects Serialize objects output to XML on remote machine, deserialize XML back to objects
WHY IS IT IMPORTANT Automation Automation Windows Server Core Windows Server Core Windows Nano Server Windows Nano Server Azure Azure Office 365 Office 365
ENABLE REMOTING - DEMO Local Machine Local Machine Remote Server & Client – in Domain environment Remote Server & Client – in Domain environment Remote Server & Client – in Workgroup environment Remote Server & Client – in Workgroup environment
USING REMOTING 1:1 1:1 1:N 1:N Persistent Sessions Persistent Sessions Implicit Remoting Implicit Remoting
1:1 REMOTING Interactive like Telnet/SSH Interactive like Telnet/SSH Does not load or process profile scripts Does not load or process profile scripts Enter-PSSession –ComputerName Enter-PSSession –ComputerName BEWARE: second-hop remoting BEWARE: second-hop remoting Demo Demo
1:N REMOTING Focussed on Automation Focussed on Automation Invoke-Command –ComputerName –FilePath file.ps1 Invoke-Command –ComputerName –FilePath file.ps1 Invoke-Command –ComputerName –ScriptBlock { } Invoke-Command –ComputerName –ScriptBlock { } Demo Demo
PERSISTENT SESSIONS Reduce overhead/Increase speed Reduce overhead/Increase speed Preserve state Preserve state Demo Demo
IMPLICIT REMOTING Obtain access to remote modules Obtain access to remote modules Demo Demo
EXTRA INFO EXTRA INFO PowerShell WebAccess PowerShell WebAccess Constrained Endpoints Constrained Endpoints
QUESTIONS? Thank you for your attention!