I’m looking to grab the CPU Model information from various Computers on my Local AD Network. and I was wondering if this was possible. Right now I have a script to grab all the copmuters and their OSs on the domain, and I’ve been able to grab my computer’s CPU info, but not much more than that. Here’s my code so far. Have any ideas? All computer names and location data have been redacted due to company policies.
#LIST ALL COPMUTERS FROM LOCATION, THIER IPAS, AND OS
#VARIABLES FOR COUNTING THE NUMBER OF COMPUTERS
$WS = Get-ADComputer -Filter ‘Name -like “SV1*” -or Name -like “SV2*”’ -Properties IPv4Address, OperatingSystem | Select Name, IPv4Address, OperatingSystem
$WS2 = Get-ADComputer -Filter ‘Name -like “SV3*”’ -Properties IPv4Address, OperatingSystem | Select Name, IPv4Address, OperatingSystem
$WX = Get-ADComputer -Filter ‘Name -like “PC1*” -or Name -like “PC2*”’ -Properties IPv4Address, OperatingSystem | Select Name, IPv4Address, OperatingSystem
$W1 = Get-ADComputer -Filter ‘Name -like “PC1*” -or Name -like “PC2*”’ -Properties IPv4Address, OperatingSystem | Select Name, IPv4Address, OperatingSystem
$W7 = Get-ADComputer -Filter ‘Name -like “PC1*” -or Name -like “PC2*”’ -Properties IPv4Address, OperatingSystem | Select Name, IPv4Address, OperatingSystem
$XP = Get-ADComputer -Filter ‘Name -like “PC1*” -or Name -like “PC2*”’ -Properties IPv4Address, OperatingSystem | Select Name, IPv4Address, OperatingSystem
$WP = Get-ADComputer -Filter ‘Name -like “PC1*” -or Name -like “PC2*”’ -Properties IPv4Address, OperatingSystem | Select Name, IPv4Address, OperatingSystem
$UnL = Get-ADComputer -Filter ‘Name -like “PC1*” -or Name -like “PC2*”’ -Properties IPv4Address, OperatingSystem | Select Name, IPv4Address, OperatingSystem
#LIST ALL WINDOWS 10 COPMUTERS
#Get-ADComputer -Filter ‘Name -like “PC1*” -or Name -like “PC2*”’ -Properties IPv4Address, OperatingSystem | Select Name, IPv4Address, OperatingSystem
#LIST ALL WINDOWS 7 COMPTUERS
#Get-ADComputer -Filter ‘Name -like “PC1*” -or Name -like “PC2*”’ -Properties IPv4Address, OperatingSystem | Select Name, IPv4Address, OperatingSystem
#LIST ALL WINDOWS 11 COMPUTERS
#Get-ADComputer -Filter ‘Name -like “PC1*” -or Name -like “PC2*”’ -Properties IPv4Address, OperatingSystem | Select Name, IPv4Address, OperatingSystem
#COUNTING THE NUMBER OF OS COMPUTERS
$WS = $WS.count
$WS2 = $WS2.count
#ADDING THE SERVER COUNTS TOGETHER
$WS = $WS + $WS2
$W1 = $W1.count
$WX = $WX.count
$W7 = $W7.count
$XP = $XP.count
$WP = $WP.count
$UnL = $UnL.count
#SUBTRACING THE SERVERS FROM UnNamed COMPUTERS COUNT
$TotalCount = $W1 + $WX + $W7 + $XP + $WP + $WS
$UnL = $UnL - $WS
$UnL = $UnL - $TotalCount
#SUBTRACING THE SERVERS FROM UnNamed COMPUTERS COUNT
#$UnL = $UnL - $WS
#$UnL = $UnL - $TotalCount
Write-Host "Windows Servers: " $WS
Write-Host "Windows 11 Computers: " $W1
Write-Host "Windows 10 Computers: " $WX
Write-Host "Windows 7 Computers: " $W7
Write-Host "Windows XP Computers: " $XP
Write-Host "Windows 2000 Computers: " $WP
#Write-Host "UnNamed Computers: " $UnL
Write-Host " "
Write-Host "Total number of Active Computers: " $TotalCount
#$ComputerList = Get-ADComputer -Filter ‘Name -like "PC1*’" -or Name -like “PC2*”’ | Select Name
#$CPUSearchSession = New-PSSession -ComputerName $ComputerList
#icm $ComputerList {get-wmiobject Win32_Processor | Select Name}
#ForEach $ComputerSearchList {
#$ComputerSearchList = Get-ADComputer -Filter ‘Name -like “PC1*” -or Name -like “ALKLS*”’ | Select Name
#Get-WmiObject -Class Win32_Processor -ComputerName $ComputerSearchList
#}
Start-Sleep
#$ComputerSearchList = Get-ADComputer -Filter ‘Name -like “PC1*”’ | Select Name
#$ComputerSearchList | ForEach-Object {
$ComputerSearchList = Get-ADComputer -Filter ‘Name -like “PC1*”’ | Select Name
Get-WmiObject -Class Win32_Processor | Select Name
#}
For ((i=0) (i -lt $TotalCount), (i++)) {
Get-WmiObject -Class Win32_Processor -ComputerName “PC1*” | Select Name
}
#COULD USE THE COUNT OF TOTAL COMPUTERS AS A LOOP INT AND TEST
#TO SEE IF THE COMPUTER NAME EXISTS, IF IT DOESN’T, ADD 1 TO INT NUMBER
#AND KEEP RUNNING THROUGH THE LOOP UNTILL ALL COUMPUTER NAMES HAVE
#BEEN LOOPED THROUGH AND CHECKED FOR CPU NAME
Start-Sleep