I have compiled this scripts with help of Bhupinder and Thom McKiernan script from internet and all working fine except I do not get the 2nd monitor info if there is 2nd monitor. I would really appreciate if someone can help me with this. I am not good at the pow3rshell but learning.... Thanks in Advance.
Blockquote
$ArrComputers = read-host -Prompt "Enter Computer Name"
function Decode {
If ($args[0] -is [System.Array]) {
[System.Text.Encoding]::ASCII.GetString($args[0])
}
Else {
"Not Found"
}
}
Clear-Host
foreach ($Computer in $ArrComputers)
{
$wmi_os = Get-WmiObject -class Win32_OperatingSystem -ComputerName $Computer | select CSName,Caption,Version,OSArchitecture,LastBootUptime
switch($wmi_os.Version){
'10.0.10240'{$wmi_build="1507"}
'10.0.10586'{$wmi_build="1511"}
'10.0.14393'{$wmi_build="1607"}
'10.0.15063'{$wmi_build="1703"}
'10.0.16299'{$wmi_build="1709"}
'10.0.17134'{$wmi_build="1803"}
'10.0.17686'{$wmi_build="1809"}
'10.0.18362'{$wmi_build="1903"}
'10.0.18363'{$wmi_build="1909"}
'10.0.19042'{$wmi_build="2009"}
}
$computerSystem = get-wmiobject Win32_ComputerSystem -Computer $Computer
$computerBIOS = get-wmiobject Win32_BIOS -Computer $Computer
$computerOS = get-wmiobject Win32_OperatingSystem -Computer $Computer
$DNName = Get-ADComputer -Filter "Name -like '$Computer'" | select -ExpandProperty DistinguishedName
$computerCPU = get-wmiobject Win32_Processor -Computer $Computer
$computerHDD = Get-WmiObject Win32_LogicalDisk -ComputerName $Computer -Filter drivetype=3
$Monitors = Get-WmiObject WmiMonitorID -Namespace root\wmi -ComputerName $Computer
#$Monitors = Get-WmiObject WmiMonitorID -RELPATH root\wmi -ComputerName $Computer
ForEach ( $Monitor in $Monitors) {
$Manufacturer = Decode $Monitor.ManufacturerName -notmatch 0
$Name = Decode $Monitor.UserFriendlyName -notmatch 0
$Serial = Decode $Monitor.SerialNumberID -notmatch 0
$YofM = $Monitor.YearOfManufacture
}
write-host "System Information for: " $computerSystem.Name -BackgroundColor DarkCyan
"-------------------------------------------------------"
"Manufacturer : " + $computerSystem.Manufacturer
"Model : " + $computerSystem.Model
"Serial Number : " + $computerBIOS.SerialNumber
"CPU : " + $computerCPU.Name
"HDD Capacity : " + "{0:N0}" -f ($computerHDD.Size/1GB) + "GB"
"HDD Space : " + "{0:P0}" -f ($computerHDD.FreeSpace/$computerHDD.Size) + " Free (" + "{0:N0}" -f ($computerHDD.FreeSpace/1GB) + "GB)"
"RAM : " + "{0:N0}" -f ($computerSystem.TotalPhysicalMemory/1GB) + "GB"
"Operating System: " + $computerOS.caption + ", Service Pack: " + $computerOS.ServicePackMajorVersion
"Build Version : " + $wmi_build
"User logged In : " + $computerSystem.UserName
"OU Location : " + $DNName
"Last Reboot : " + $computerOS.ConvertToDateTime($computerOS.LastBootUpTime)
"Monitor Mfgr : " + $($Manufacturer)
"Monitor Name : " + $($Name)
"Monior S/N : " + $($Serial)
"Monitor Year : " + $($YofM)
""
"-------------------------------------------------------"
}
Blockquote
