Wednesday, May 4, 2011

How to find computer serial number

Windows Computers:

You can use one the method bellow to retrieve the computer serial number:

1. Using the buid in "wmic" command:
 "wmic bios get serialnumber"

Tip: You can use the command "wmic csproduct get name" to retrieve the local computer model.
 
2. Using a vbs script:


strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colBIOS = objWMIService.ExecQuery _
    ("Select * from Win32_BIOS")
For each objBIOS in colBIOS
    Wscript.Echo "Manufacturer: " & objBIOS.Manufacturer
    Wscript.Echo "Serial Number: " & objBIOS.SerialNumber
Next


Linux Machines:

Run the bellow command from shell.

# dmidecode -t system

Netapp Box

# sysconfig -a

Batch file to get Serial number and PID:


Create a bactch file with bellow text, which will write output to seperate TXT file with Serial number and PID.


================================
@echo off

wmic ComputerSystem >PID.txt
wmic csproduct >Model.txt
wmic bios get serialnumber >Serial.txt


================================


No comments: