Please 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: On Error Resume Next
Dim strComputer
strComputer = InputBox("Enter the name of the computer:")
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSMBIOS = objWMIService.ExecQuery ("Select * from Win32_SystemEnclosure")
For Each objSMBIOS in colSMBIOS
MsgBox strComputer & ": " & objSMBIOS.SerialNumber
Next
wmic /node:SERVER1 printer list statusWMIC /locale:ms_409 OS WMIC OS LIST BRIEF
WMIC OS GET csname, locale, bootdevice
WMIC /locale:ms_409 NTEVENT where LogFile='system'
WMIC NTEVENT where "LogFile='system' and Type>'0'"
WMIC SERVICE where (state=”running”) GET caption, name, state > services.tsv
WMIC SERVICE where caption='TELNET' CALL STARTSERVICE
WMIC PRINTER LIST STATUS
WMIC PRINTER where PortName="LPT1:" GET PortName, Name, ShareName
WMIC /INTERACTIVE N PRINTER where PortName="LPT1:" DELETE
WMIC PROCESS where name='evil.exe' delete
WMIC /output:"%computername%.txt" MEMORYCHIP where "memorytype=17" get Capacity
Interactive mode:C:>START "Windows Management" WMIC
wmic:root\cli>/locale:ms_409
wmic:root\cli>OS get csname
wmic:root\cli>quit
This is the script I ran to gather a variety of system information from server3 remotely...
del c:\GatherInfo.txt
systeminfo /s \\server3 > c:\GatherInfo.txt
driverquery /s \\server3 >> c:\GatherInfo.txt
getmac /S \\server3 >> c:\GatherInfo.txt
freedisk /s \\server3 /D C: >> c:\GatherInfo.txt
gpresult /s \\server3 >> c:\GatherInfo.txt
sc \\server3 query >> c:\GatherInfo.txt
eventquery /S \\server3 /L application /FI "type eq error" >> c:\GatherInfo.txt
notepad c:\GatherInfo.txt
Data output:
WMIC BIOS > mydata.txtWMIC OS >> mydata.txtWMIC /APPEND:mydata.txt PAGEFILEWMIC /OUTPUT:output.txt OSWMIC /OUTPUT:CLIPBOARD BIOS
Data display:
WMIC PROCESS WHERE "name like '%HOST%'"WMIC PATH Win32_Process WHERE "name like '%HOST%'"WMIC PROCESS WHERE “Name=svchost.exe” LIST StatisticsWMIC PROCESS WHERE “Name=svchost.exe” LIST BREAFWMIC PROCESS WHERE (Name='svchost.exe') GET name, processed
Some Examples and usage of WMIC:
- To get the process list – wmic process list
- To get the group list – wmic group list
- To get the NIC Card Configuration – wmic nicconfig list
- To get user account list – wmic useraccount list
- To get the built in System account list – wmic sysaccount
- To get the Environment list – wmic environment list
- To get the information of all shares (including hidden) – wmic share list
- To get the list of services – wmic services list
- To get the computer system details – wmic computersystem list
- To get the volume information – wmic volume list
- To get full startup list – wmic startup list full
- To get Information of logical disks – wmic logicaldisk get description, filesystem, name, size
- To get screensaver information – wmic desktop get screensaversecure, screensavertimeout
- To get logon information – wmic logon get authenticationpackage
- To get information about the OS – wmic os get name, servicepackmajorversion
- To get information about QFE (Quick Fix Engineering) – wmic qfe get description,installedOn
- To get information about the computer – wmic csproduct get name,vendor,identifyingNumber
- To get the toal ram – wmic computersystem get TOTALPhysicalMemory,caption
- To get the macaddress of nic card – wmic nic get macaddress,description