Menu / List Loaded Powershell Functions
List Loaded Powershell Functions
List all loaded PowerShell functions in the current session.
menu menu #!/bin/bash
# List Loaded Powershell Functions
menu import subprocess
# List Loaded Powershell Functions
# Make sure to replace <placeholders> with actual values
def run_command():
cmd = [
"menu",
]
try:
print(f"Executing: {' '.join(cmd)}")
subprocess.run(cmd, check=True)
except subprocess.CalledProcessError as e:
print(f"Error: {e}")
except FileNotFoundError:
print("Error: menu not found. Please install it first.")
if __name__ == "__main__":
run_command() When To Use
During a security assessment for available PowerShell functions on a compromised host.
Pro Tip
Combine with the 'where' clause to filter results for specific functions.
Anatomy of Output
Understanding the result
Function Name : Get-Process First Function Listed Displays a standard cmdlet for retrieving process information.
Function Name : Set-ExecutionPolicy Second Function Listed Function to change the execution policy of PowerShell.
Function Count : 50 Total Functions Counted Total number of functions currently loaded in the session.
Troubleshooting
Common pitfalls
[-] Cannot find any functions.
Solution: Ensure functions have been loaded in the current session.
[-] Access denied when executing Get-Command.
Solution: Verify the user has permission to execute scripts in the session.
[-] Error retrieving functions: Invalid syntax.
Solution: Check for syntax errors in the command input.
Command Breakdown
What each part is doing
-
menu - Base Command
- The executable that performs this operation. Here it runs Menu before the shell applies any redirect operators.
Alternative Approaches
Comparable commands in other tools
Alternative system operations tools for the same job.