Monitor Inventory RRS feed

  • Question

  • I have the following script that works fine on one computer. However we have over 250 computers that I would like to inventory monitors. I have a text file with computer names. Could someone point me in the right direction to be able to inventory a list of computers?
    Function ConvertTo-Char
    	$Output = ""
    	ForEach($char in $Array)
    	{	$Output += [char]$char -join ""
    	return $Output
    $Query = Get-WmiObject -Query "Select * FROM WMIMonitorID" -Namespace root\wmi
    $Results = ForEach ($Monitor in $Query)
    	New-Object PSObject -Property @{
    		ComputerName = $env:ComputerName
    		Active = $Monitor.Active
    		Manufacturer = ConvertTo-Char($Monitor.ManufacturerName)
    		MakeModel = ConvertTo-Char($Monitor.userfriendlyname)
    		SerialNumber = ConvertTo-Char($Monitor.serialnumberid)
    		YearOfManufacture = $Monitor.YearOfManufacture
    $Results | Select ComputerName,MakeModel,SerialNumber,YearOfManufacture



    • Moved by Bill_Stewart Wednesday, September 4, 2019 7:22 PM This is not "design solution for me" forum
    Monday, March 25, 2019 5:03 PM

All replies

  • WMI has a computer parameter.  Just specify the list of computer

    Get-WmiObject …. -ComputerName $computers

    Always read the complete CmdLet help carefully before asking any questions.  What you are asking is detailed in the help examples.


    Monday, March 25, 2019 5:54 PM
  • Note also that the way to convert a byte array into text is like this:



    Monday, March 25, 2019 6:32 PM