Thursday, January 5, 2012

Retrieve the computer serial number

Instructions
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:
  1. To get the process list – wmic process list
  2. To get the group list – wmic group list
  3. To get the NIC Card Configuration – wmic nicconfig list
  4. To get user account list – wmic useraccount list
  5. To get the built in System account list – wmic sysaccount
  6. To get the Environment list – wmic environment list
  7. To get the information of all shares (including hidden) – wmic share list
  8. To get the list of services – wmic services list
  9. To get the computer system details – wmic computersystem list
  10. To get the volume information – wmic volume list
  11. To get full startup list – wmic startup list full
  12. To get Information of logical disks – wmic logicaldisk get description, filesystem, name, size
  13. To get screensaver information – wmic desktop get screensaversecure, screensavertimeout
  14. To get logon information – wmic logon get authenticationpackage
  15. To get information about the OS – wmic os get name, servicepackmajorversion
  16. To get information about QFE (Quick Fix Engineering) – wmic qfe get description,installedOn
  17. To get information about the computer – wmic csproduct get name,vendor,identifyingNumber
  18. To get the toal ram – wmic computersystem get TOTALPhysicalMemory,caption
  19. To get the macaddress of nic card – wmic nic get macaddress,description

0 comments:

Post a Comment