I have a startup script that captures an IP address out of the registry using the following code:
$icaaddr=(Get-ItemProperty "HKLM:\SOFTWARE\Wow6432Node\Citrix\XTEConfig" -Name "DefaultICAAddress")
[Net.IPAddress]$icaaddr=$icaaddr.DefaultICAAddress
Later in that script that IP is used for different things and it is added to the "Message" output as such
$message+="ICA address found to be: $icaaddr `n"
However today on one server instead of an IP the following was captured.
ICA address found to be: @{DefaultICAAddress=; PSPath=Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Citrix\XTEConfig; PSParentPath=Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Citrix; PSChildName=XTEConfig; PSDrive=HKLM; PSProvider=Microsoft.PowerShell.Core\Registry}
So my questions are 2
- What would cause such output
- How could I test for this 'state'
Long story short is when the ouptut is like that I need to have the server rebooted. How can I test the $icaaddr variable contains a valid IP address