I need to determine where to load "Company" form a configuration file.
<config>
<username>$env:username</username>
<company>$User.Company</company>
</config>
After loading the config file:
$ConfigFile=[xml](Get-Content $ConfigFileName)
$ConfigFile.config.Company
It returns:
$User.Company
"$User" is another object, where $User.Company equals:
ACME Company
I had tried:
$Company=$ExecutionContext.InvokeCommand.ExpandString($ConfigFile.config.Company)
But that only expands "$User", not "$User.Company".
How do I set $Company to $Config.config.Company that will result in a string "ACME Company"?