Extract Object Type from Custom PowerShell Object -
if have custom powershell object int, boolean, , pscredential, need able write out location. easiest solution foreach loop, need treat pscredential differently of course. how can exclude pscredential foreach when writing out other values?
custom object initialized similar to:
$myobj = [pscustomobject]@{ value1 = [string] value2 = [int] value3 = $null} further on in processing of script, value3 set get-credential , user prompted credentials.
use select restrict properties appearing output:
$myobj | select -property * -excludeproperty value3 note must utilize -property * here, otherwise -excludeproperty won't have effect.
powershell
No comments:
Post a Comment