Advertisement
Lee_Dailey

SysInfo - DesktopMonitor

Jun 4th, 2018
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # SysInfo - DesktopMonitor
  2.  
  3. $SysInfoProps = [ordered]@{}
  4.  
  5. $CIM_DesktopMonitor = @(Get-CimInstance -ClassName CIM_DesktopMonitor)
  6.  
  7. foreach ($CDM_Item in $CIM_DesktopMonitor)
  8.     {
  9.     $Index = "{0:D2}" -f $CIM_DesktopMonitor.IndexOf($CDM_Item)
  10.     $SysInfoProps.Add("Vid_Monitor_${Index}_Name", $CDM_Item.Name)
  11.     $SysInfoProps.Add("Vid_Monitor_${Index}_Manufacturer", $CDM_Item.MonitorManufacturer)
  12.     $SysInfoProps.Add("Vid_Monitor_${Index}_PPI_Logical_X", $CDM_Item.PixelsPerXLogicalInch)
  13.     $SysInfoProps.Add("Vid_Monitor_${Index}_PPI_Logical_Y", $CDM_Item.PixelsPerYLogicalInch)
  14.     $SysInfoProps.Add("Vid_Monitor_${Index}_ScreenRes_X", $CDM_Item.ScreenWidth)
  15.     $SysInfoProps.Add("Vid_Monitor_${Index}_ScreenRes_Y", $CDM_Item.ScreenHeight)
  16.     }
  17.  
  18. $CIM_MonitorID = Get-CimInstance -Namespace root\wmi -ClassName wmiMonitorID
  19.  
  20. foreach ($CMID_Item in $CIM_MonitorID)
  21.     {
  22.     $MfgID = -join $CMID_Item.ManufacturerName.ForEach({[char]$_})
  23.     $ProductCodeID = -join $CMID_Item.ProductCodeID.ForEach({[char]$_})
  24.     $SerialNumber = -join $CMID_Item.SerialNumberID.ForEach({[char]$_})
  25.     $FriendlyName = -join $CMID_Item.UserFriendlyName.ForEach({[char]$_})
  26.     $MfgDate = ((Get-Date -Year $CMID_Item.YearOfManufacture -Month 1 -Day 1).
  27.         AddDays(7 * $CMID_Item.WeekOfManufacture)).
  28.         ToString('yyyy-MM-dd')
  29.  
  30.     $Index = "{0:D2}" -f $CIM_MonitorID.IndexOf($CMID_Item)
  31.  
  32.     $SysInfoProps.Add("Vid_Monitor_${Index}_Active", $CMID_Item.Active)
  33.     $SysInfoProps.Add("Vid_Monitor_${Index}_MfgID", $MfgID)
  34.     $SysInfoProps.Add("Vid_Monitor_${Index}_ProductCodeID", $ProductCodeID)
  35.     $SysInfoProps.Add("Vid_Monitor_${Index}_SerialNumber", $SerialNumber)
  36.     $SysInfoProps.Add("Vid_Monitor_${Index}_FriendlyName", $FriendlyName)
  37.     $SysInfoProps.Add("Vid_Monitor_${Index}_MfgYear", $CMID_Item.YearOfManufacture)
  38.     $SysInfoProps.Add("Vid_Monitor_${Index}_MfgWeek", $CMID_Item.WeekOfManufacture)
  39.     $SysInfoProps.Add("Vid_Monitor_${Index}_MfgDate", $MfgDate)
  40.     }
  41.  
  42. $SysInfoProps
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement