Created
October 6, 2022 14:38
-
-
Save SeidChr/80c350f9ba5f1e2a36c020ac86a416d0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filter To-Select { | |
$object = $_ | |
$type = $_.GetType() | |
if ($type -in [hashtable],[pscustomobject]) { | |
$properties = ([pscustomobject] $_).psobject.properties | |
$propNames = $properties.name | |
if (-not ("Name" -in $propNames -and "Expression" -in $propNames)) { | |
$object = $properties | ForEach-Object { | |
@{ | |
Name = $_.name | |
Expression = $_.value | |
} | |
} | |
} | |
} | |
return $object | |
} | |
Get-Process | Select -First 2 -Property ('Name', @{ 'IncrementalId' = { $_.ID + 5 }; BasePrio = { $_.BasePriority * 1000 } } | To-Select) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment