Recently, someone posted a question on how to get monitor information from the command line: http://www.itninja.com/question/get-the-max-screen-resolution-via-cli
This functionality is not a built in feature of the K1000 as of 5.4, but it is possible to obtain monitor information using a third party program called MonitorInfoView. With that, a managed install can deploy the program to machines and it is possible to then use a custom inventory rule to return the information needed from the monitor. Other applications could be used, but this one in particular will run from the command line, so it is easy to use in the K1000. The application appears to be freeware, but please ensure proper licensing is obtained if necessary. MonitorInfoView can be downloaded here: http://www.nirsoft.net/utils/monitor_info_view.html
This information was tested to work on K1000 version 5.4.76848, using agent version 5.4.10622 on Windows 7, but it should work with XP and Win8 so long as MonitorInfoView works with both.
Steps to create the managed install:
1. Create a new custom software inventory item for MonitorInfoView and upload the zip file to it. Name, describe and add supported operating systems as needed. Please note, a custom inventory rule will need to be added later. Inventory>Software>Choose Action>Add New Item
2. Create a new managed install for MonitorInfoView. Distribution>Choose Action>Add New Item
- Select MonitorInfoView from the drop-down menu next to Software. It may be necessary to use the filter to find it.
- Under Installation Command, select the radio button for "Configure Manually".
- In the text box under "Configure Manually", input the installation command. In this example, this command was used: MonitorInfoView.exe /HideInactiveMonitors 1 /stext C:\Windows\System32\monitor.txt
NOTE: Further switches are available from the publisher's website. "C:\Windows\System32\" was used as the output location because that that is present on both Windows XP and Windows 7. - Limit the deployment as needed by machine name or label.
- Save.
3. Go back to the software inventory time created in step 1 and add a custom inventory rule. A custom inventory rule is needed so that the managed install doesn't get installed multiple times. For this example, the rule is as follows for Windows 7 in the environment this was tested in, but the number (5601) will vary in different environments: FileExists(C:\ProgramData\Dell\KACE\downloads\5601\MonitorInfoView.exe)
To find the number of the software inventory item to substitute for 5601, hover the mouse over the item in the software inventory list. A link should be displayed in the lower left that shows the software inventory item number, similar to this http://k1000/adminui/software.php?ID=XXXX, where XXXX is unique to the environment. Alternatively, if the user is logged into the K1000 interface with "http://k1000/adminui" as opposed to simply "admin", the software inventory item number will be displayed in the browser's address bar if the item is clicked on.
Mouse-over example:
If XP is used as well, the custom inventory rule should look something like this (substituting the necessary software ID for XXXX):
FileExists(C:\Documents and Settings\All Users\Dell\KACE\downloads\XXXX\MonitorInfoView.exe) OR FileExists(C:\ProgramData\Dell\KACE\downloads\XXXX\MonitorInfoView.exe)
4. Create a new software inventory item to parse the results from MonitorInfoView.exe. This will be similar to the software inventory item created earlier, but with a different title and custom inventory rule. For this example, it was titled "MonitorInfoView results CIR". The custom inventory rule used was:
ShellCommandTextReturn(findstr "Monitor Name";"Serial Number" c:\windows\system32\monitor.txt)
NOTE: You may have to add cmd /c in front of findstr in the above command for it to work.
5. Deploy the managed install to computers. Once the managed install is run and the machines check in afterwards, it should now display any attached monitors under Software>Custom Inventory Fields on the machine's inventory page, similar to this:
One thing to note: Using this method, MonitorInfoView.exe only runs on the intial deployment of the managed install. To have it run again, there are a couple of options:
1. Use a Kscript to delete the monitor.txt file, then to run something like this to generate a new file: C:\ProgramData\Dell\KACE\downloads\XXXX\MonitorInfoView.exe /HideInactiveMonitors 1 /stext C:\Windows\System32\monitor.txt
2. Delete the folder that the .exe is in, delete monitor.txt and redeploy the managed install. A Kscript could be used to delete the following: C:\ProgramData\Dell\KACE\downloads\XXXX\ and C:\Windows\System32\monitor.txt
Also, once the MI has run and the systems checked in, monitor information can be reported on using the Reporting Wizard. Select a computer report and use the "Custom Fields" option to include the rule that was just created.
Disclaimer: All of my posts are my own personal opinion or knowledge. Even though I work for Dell KACE, there is no implied support from Dell KACE for this information. Please comment here if you have any specific questions on this blog post.
I found this link because I was trying to figure out how to populate KACE asset information from the results of a powershell script ran on the workstation... - greg.baughman@800plateau.com 6 years ago