PowerShell PowerShell $code = { Get-Process Get-Service $var2 = 12 } [System.Management.Automation.PSParser]::Tokenize($code,[ref]$null) | ForEach-Object { if ($_.Type -eq 'Command') { $_.content } } 123456789101112 $code = { Get-Process Get-Service $var2 = 12} [System.Management.Automation.PSParser]::Tokenize($code,[ref]$null) |ForEach-Object { if ($_.Type -eq 'Command') { $_.content }}