Skip to content

Instantly share code, notes, and snippets.

@jetstreamin
Created September 16, 2019 03:17
Show Gist options
  • Save jetstreamin/5d88f779ca69cc8a55bd4fe68dd7d98a to your computer and use it in GitHub Desktop.
Save jetstreamin/5d88f779ca69cc8a55bd4fe68dd7d98a to your computer and use it in GitHub Desktop.
PowerShell - Fingerprint Commands and Server Information
Write-Output 'Hello World'
$env:computername
## Function to fingerprint commands executed during the execution of this runbook
Function Invoke-Fingerprint {
param ( $cmd )
Write-Output '---------------------------'
Write-Output $cmd
Invoke-Expression $cmd
}
Invoke-Fingerprint -cmd '$PSVersionTable'
Invoke-Fingerprint -cmd 'Get-Module'
Invoke-Fingerprint -cmd 'Get-Module -ListAvailable'
Invoke-Fingerprint -cmd 'Get-Process'
Invoke-Fingerprint -cmd '$pwd'
Invoke-Fingerprint -cmd 'Get-ChildItem $pwd'
Invoke-Fingerprint -cmd 'Get-ChildItem C:\'
Invoke-Fingerprint -cmd 'Get-PSDrive'
Invoke-Fingerprint -cmd 'Get-ChildItem Env:'
Invoke-Fingerprint -cmd 'Get-ExecutionPolicy'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment