When using Kixtart scripts, if ReadValue() function is used it returns NULL value, for example, below code should save the third octet saved in ClientAddress value:
$ReturnCode = KeyExists("HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\ICA\Session\1\Connection")
If $ReturnCode
$RegIPAddress = ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\ICA\Session\1\Connection", "ClientAddress")
$IPArray = split($RegIPAddress, ".")
$OfficeIP = $IPArray[2]
endif
However the value assigned to $OfficeIP is Null.
To solve this, one way is to reference the "redirected" path - "HKLM\SOFTWARE\WOW6432Node\..."
The other way is to turn on the automatic redirection with this line: $Rc = SetOption('WOW64AlternateRegView', 'On')
The resulting code would be:
$ReturnCode = KeyExists("HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\ICA\Session\1\Connection")
If $ReturnCode
$Rc = SetOption('WOW64AlternateRegView', 'On')
$RegIPAddress = ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\ICA\Session\1\Connection", "ClientAddress")
$IPArray = split($RegIPAddress, ".")
$OfficeIP = $IPArray[2]
endif
It will find the value in the correct location.