I have a clause for the most part works but for some reason it gives error on some machines. When I hover the mouse over the error in the console it returns 2 values, 1 for the name and the other Singular expression refers to non-unique object. Any ideas.
if (exists wmi) then (if (exists string value of selects “Name from Win32_DesktopMonitor” of wmi) then (string value of selects “Name from Win32_DesktopMonitor” of wmi) else nothing) else (nothing)
You need to specify it in plural, so try “string values”.
On the endpoint with error, the first item returned correctly, but the 2nd item generated the error because it is supposed to be singular.
if (exists wmi) then (if (exists string value of selects “Name from Win32_DesktopMonitor” of wmi) then (string values of selects “Name from Win32_DesktopMonitor” of wmi) else nothing) else (nothing)
(string value of property “ScreenHeight” of it & “x” & string value of property “ScreenWidth” of it) of select objects “ScreenWidth, ScreenHeight from Win32_DesktopMonitor” of wmi
WMI results can be slow, also can fail on specific machines as the WMI interface might be causing errors for the system as a whole. WMI can easily be broken by many applications causing the interface to not work. The error its giving you might help and search for how to fix that type of WMI error.