Kaseya Community

Script to audit Monitor models

This question is not answered

I'm trying to write a script that will report back to me what monitors (model) are connected to the computer. I found this tool (http://www.nirsoft.net/utils/monitor_info_view.html) however it gives me every monitor that was ever plugged into that PC. It has an "active" field but it always shows all active=no even if that's not the case. 

Anyone have another suggestion on how to gather this information?

Verified Answer
  • One of my sales guys just asked me about doing something like this earlier this morning. I wrote a quick script and got the same results when executing the command as 'system'.  You need to switch the command to 'execute as user' and the user has to be logged into the system.

    It appears to not be looking for 'actively plugged in' but 'actively in use'



    grammar errors
    [edited by: sbrown at 9:47 AM (GMT -8) on Feb 12, 2019]
All Replies
  • Hi Elliot,

    try the powershell script below:

    #get monitor info

    $nr = $null

    ForEach ($Monitor in Get-WmiObject WmiMonitorID -Namespace root\wmi) {

       $nr = $nr+1

       $Name = Decode $Monitor.UserFriendlyName -notmatch 0

       $Serial = Decode $Monitor.SerialNumberID -notmatch 0

       $regkey1 = "Monitor $nr Name"

       $regkey2 = "Monitor $nr Serial"

       Set-ItemProperty -path $Regpath -name $regkey1 -value $name -Force

       Set-ItemProperty -path $Regpath -name $regkey2 -value $serial -Force

       }

    regards,

    Jaap

  • One of my sales guys just asked me about doing something like this earlier this morning. I wrote a quick script and got the same results when executing the command as 'system'.  You need to switch the command to 'execute as user' and the user has to be logged into the system.

    It appears to not be looking for 'actively plugged in' but 'actively in use'



    grammar errors
    [edited by: sbrown at 9:47 AM (GMT -8) on Feb 12, 2019]
  • how do i tell the powershell to export info to .txt file? which i can then capture in kaseya script and email

  • You used the nirsoft app or powershell script posted above?

  • I used the nirsoft app for mine.  My sales guy is already using it!

  • Hi Elliot,

    What was not in the script example was the regpath variable.

    This is a registry location (HKLM\software\[companyname]\ or whatever).

    Here I put values i want to import into the custom fields in Kaseya.

    My experience is that retrieving (registry) info from a agent is a lot easier this way.

  • Yes, switching to run as "user" was the fix! Thanks for the help. Works perfectly now!

    This will help a lot!

  • Can you share your script?

    Thanks!

  • Procedure Audit Monitor Information and Specs.xml

    See attached and you can download the nirsoft app from https://www.nirsoft.net/utils/monitor_info_view.html 

    (change kaseya temp directory to your own)

  • Thanks Elliot!