Link to home
Get AccessLog in
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 :)
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

wmic csproduct get vendor, version

Open in new window


wmic bios get serialnumber

Open in new window

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


Avatar of J Muro
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!
ASKER CERTIFIED SOLUTION
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

Link to home
membership
This content is only available to members.
To access this content, you must be a member of Experts Exchange.
Get Access

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

Avatar of J Muro

ASKER

That is exactly what I needed!

Thank you Zvonko! :)

J.

You are welcome.