Skip to content

Instantly share code, notes, and snippets.

@Jaykul
Created November 21, 2015 06:17
Show Gist options
  • Save Jaykul/3cc4bfb629ce7fbf9259 to your computer and use it in GitHub Desktop.
Save Jaykul/3cc4bfb629ce7fbf9259 to your computer and use it in GitHub Desktop.
PSBoundParameterValues++
Update-TypeData -TypeName System.Management.Automation.InvocationInfo -MemberName ParameterValues -MemberType ScriptProperty -Value {
$results = @{}
foreach($parameter in $this.MyCommand.Parameters.GetEnumerator()) {
try {
$key = $parameter.Key
if($value = Get-Variable -Name $key -Scope 1 -ValueOnly -ErrorAction Ignore) {
$results.$key = $value
}
} finally {}
}
return $results
} -Force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment