Hi,
The issue should have been fixed in the last script. Please check if the below one works. I just replaced the Get-CimInstance with Get-WmiObjcet.
$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 -Class Win32_ComputerSystem -ComputerName $Computer
$computerBIOS = Get-WmiObject -Class Win32_BIOS -ComputerName $Computer
$computerOS = Get-WmiObject -Class Win32_OperatingSystem -ComputerName $Computer
$DNName = Get-ADComputer -Filter "Name -like '$Computer'" | select -ExpandProperty DistinguishedName
$computerCPU = Get-WmiObject -Class Win32_Processor -ComputerName $Computer
$computerHDD = Get-WmiObject -Class Win32_LogicalDisk -Filter drivetype=3 -ComputerName $Computer
$Monitors = Get-WmiObject -Class WmiMonitorID -Namespace root\wmi -ComputerName $Computer
$Manufacturer = @()
$Name = @()
$Serial = @()
$YofM = @()
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)
""
"-------------------------------------------------------"
}
Best Regards,
Ian Xue
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.