Ok, I give up. Â This should be simple, but I can’t work it out.
$foo="bar" $bar="blah" get-item variable:foo, variable:bar
gives me:
Name Value ---- ----- foo bar bar blah
So far, so good.
But:
get-item env:username, variable:foo, variable:bar
gives me:
Name Value
---- -----
USERNAME sbass
PSPath : Microsoft.PowerShell.Core\Variable::foo
PSDrive : Variable
PSProvider : Microsoft.PowerShell.Core\Variable
PSIsContainer : False
Name : foo
Description :
Value : bar
Visibility : Public
Module :
ModuleName :
Options : None
Attributes : {}
PSPath : Microsoft.PowerShell.Core\Variable::bar
PSDrive : Variable
PSProvider : Microsoft.PowerShell.Core\Variable
PSIsContainer : False
Name : bar
Description :
Value : blah
Visibility : Public
Module :
ModuleName :
Options : None
Attributes : {}
How can I get a nice tidy name/value pair tabular output for a combined env: and variable: listing?
BTW, I know that env: is a dictionary and variable: is an object. Â I can’t figure out how to cast one or the other into the right type to get the combined name/value output.