How to do it...

  1. In this recipe, we will start by loading the PowerShell extension with the load powershell command and have a look at which commands were added to our Meterpreter session using the help command:
meterpreter > load powershellLoading extension powershell...Success.meterpreter > help powershell Powershell Commands=================== Command Description------- -----------powershell_execute Execute a Powershell command stringpowershell_import Import a PS1 script or .NET Assembly DLLpowershell_shell Create an interactive Powershell prompt  meterpreter >
  1. The first command we will check is the powershell_execute command, which allows us to execute PowerShell commands:
meterpreter > powershell_execute $PSVersionTable[+] Command ...

Get Metasploit Penetration Testing Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.