So I’m trying to monitor Intune sync error codes. Conveniently they’re stored in a registry value so I don’t have to mess with event logs, and the relevance I wrote to get the raw decimal error seems to work fine. However, the relevance I wrote to get the same value and convert it to hex only works some of the time and I don’t know why. (When it doesn’t work it produces <undefined>
.)
if ((preceding text of first “T” of (value “ServerLastSuccessTime” of key “Protected\ConnInfo” of keys of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Provisioning\OMADM\Accounts” of native registry as string)) as integer) < ((preceding text of first “T” of (value “ServerLastFailureTime” of key “Protected\ConnInfo” of keys of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Provisioning\OMADM\Accounts” of native registry as string)) as integer) then value “LastSessionResult” of key “Protected\ConnInfo” of keys of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Provisioning\OMADM\Accounts” of native registry as hexadecimal as string else if (((preceding text of first “Z” of following text of first “T” of (value “ServerLastSuccessTime” of key “Protected\ConnInfo” of keys of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Provisioning\OMADM\Accounts” of native registry as string)) as integer) < ((preceding text of first “Z” of following text of first “T” of (value “ServerLastFailureTime” of key “Protected\ConnInfo” of keys of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Provisioning\OMADM\Accounts” of native registry as string)) as integer) AND (value “LastSessionResult” of key “Protected\ConnInfo” of keys of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Provisioning\OMADM\Accounts” of native registry as integer) > 0) then value “LastSessionResult” of key “Protected\ConnInfo” of keys of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Provisioning\OMADM\Accounts” of native registry as integer as hexadecimal as string else “Intune Synced”
The only difference between this relevance and the other is the addition of “as hexidecimal” so I really don’t see why it only works a minority of the time. Any advice is appreciated because I need to get this cleaned up and functional to feed a report.