WMI to retrieve Monitor Description

(imported topic written by jpeppers91)

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)

(imported comment written by Lee Wei)

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)

Lee Wei

(imported comment written by Lee Wei)

Sorry, the asterisks are supposed to bold the “string values”, so please remove them from the statement.

(imported comment written by jpeppers91)

What about this one…

(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

(imported comment written by Lee Wei)

That looks correct. Are you getting an error?

(imported comment written by jpeppers91)

Strangely some machines give an error.

(imported comment written by SystemAdmin)

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.