Avatar of J Muro
J Muro
 asked on

Determine PC Model and Serial of remote computers with command line or Powershell

Hi everyone!

I have a list of PC hostnames on a spreadsheet which users are logged into daily. I have no other information as to the model of the PCs etc.
Is there a way from the command line/PowerShell or a tool I could use to determine this information without having to interrupt and without user knowing?

The main goal is to find out the Serial number of each PC, bonus would be  knowing which OS etc running etc.

Hope that makes sense!

Many Thanks :)
* commandsScripting LanguagesPC

Avatar of undefined
Last Comment
Zvonko

8/22/2022 - Mon
Zvonko

wmic csproduct get vendor, version

Open in new window


wmic bios get serialnumber

Open in new window

Zvonko

And here the powershell script:

(Get-Content C:\Zvonko\computerList.txt).Trim() | ForEach { 
	$Computer = $_ 
	If (Test-Connection -ComputerName $Computer -Count 1 -Quiet) { 
	 	Write-Host "Computer: $Computer" 
		$Sytem = Get-WmiObject Win32_ComputerSystem -Computer $Computer 
		$Bios = Get-WmiObject Win32_Bios -Computer $Computer 
		$props = @{ 
			ComputerName = $Computer 
			Manufacturer = $Sytem.Manufacturer 
			Model = $Sytem.Model 
			SerialNumber = $Bios.SerialNumber 
		}  
        New-Object PsObject -Property $props  
    } Else { 
        Write-Warning "Computer $Computer cannot be reached, skipping." 
    } 
} | Sort ComputerName | 
	Select ComputerName,Manufacturer,Model,SerialNumber | 
	Export-Csv C:\Zvonko\computerDetails.csv -NoTypeInformation

Open in new window


J Muro

ASKER
Thanks for your message Zvonko. Apologies, I did not phrase my question correctly. With the commands that you provided I would like achieve the below:

I have a list of PC hostnames on a spreadsheet which users are logged into daily. I have no other information as to the model of the PCs etc.
Is there a way from the command line/PowerShell or a tool I could use to determine this information without having to interrupt and without user knowing?

The main goal is to find out the Serial number of each PC, bonus would be  knowing which OS etc running etc.

Hope that makes sense!
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
ASKER CERTIFIED SOLUTION
Zvonko

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Zvonko

PS. If you attach one such spreadsheet file here then I can change my script to read directly your ComputerNames column  :  )

J Muro

ASKER
That is exactly what I needed!

Thank you Zvonko! :)

J.
Zvonko

You are welcome.

Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.