I’ve been trying to troubleshoot a new Property for my windows servers and am at a quandry. My goal is to pull the Computer Description field from the Windows Servers.
Here’s the relevance
if (name of operating system starts with “Win”) AND (exists key “HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\lanmanserver\Parameters”) then (string value of select “srvcomment”) else (“N/A”)
The code returns: The operator “Key” is not defined
If someone can please help me understand where my relevance code is faulty, it would be greatly appreciated.
Didn’t change your logic much although I would consider “contains” vs “starts with” or even using “lowercase” to eliminate worries of MS changing the OS string from “Win” to “win” or “wIn” or any variation… In any event, using the FixLet Debugger, I made sure the following syntax returns a value IF THE VALUE exists in the registry KEY:
if ((name of operating system starts with “Win”) AND (exists key “HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\lanmanserver\Parameters” of registry)) then (value “Guid” of key “HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\lanmanserver\Parameters” of registry as string) else “N/A”
In the above example, I made sure “Guid” is a valid value in HKLM\System\CurrentControlSet\Services\lanmanserver\Parameters – However, if I use yours (“servcomment”), I get an error since that value is not defined in my workstation…