Search This Blog

Tuesday 24 January 2017

Windows Commands Line

Get serial number for RAM, motherboard, hard disk

This post explains how to find serial number for various hardware devices – RAM, Hard disk, Motherboard on a computer. We can use WMIC command to find this information.  These commands can be executed from Windows command prompt.

Get serial number of RAM chips.

wmic memorychip get serialnumber
This command lists serial number for each RAM module installed on the computer. Example below.
c:\>wmic memorychip get serialnumber
SerialNumber
91AB9A10
9EBD9A10

Get serial number for hard disks

wmic diskdrive get serialnumber
Example:
c:\>wmic diskdrive get serialnumber
SerialNumber
FR3AG13032430BC13S

Get serial number for mother boards

wmic baseboard get serialnumber

 

Get Serial number for cdrom drive

wmic cdrom where drive='d:' get SerialNumber
Replace ‘d:’ with the drive letter for the cdrom on your computer. You get error ‘No Instance(s) available’ if you don’t have CDROM drive on your computer.
c:\>wmic cdrom  get SerialNumber
No Instance(s) Available.

MAC address command














Get SID of a local user
wmic useraccount where name='username' get sid
For example, to get the SID for a local user with the login name  ‘John’, the command would be as below:

wmic useraccount where name='John' get sid

SID for current logged in domain user
Run the command ‘whoami /user’ from command line to get the SID for the logged in user.
Example:
c:\>whoami /user
USER INFORMATION
----------------
User Name      SID
============== ==============================================
mydomain\wincmd S-1-5-21-7375663-6890924511-1272660413-2944159
c:\>


Get SID for the local administrator of the computer
wmic useraccount where (name='administrator' and domain='%computername%') get name,sid

Get SID for the domain administrator
wmic useraccount where (name='administrator' and domain='%userdomain%') get name,sid

Find username from a SID
Now this is tip is to find the user account when you have a SID. One of the readers of this post had this usecase and he figured out the command himself with the help of the commands given above. Adding the same here.
wmic useraccount where sid='S-1-3-12-1234525106-3567804255-30012867-1437' get name

Find any installed windows updates
command 1.      [wmic qfe list]

command 2. [systeminfo | find ": KB"]


Windows native commands

Schedule tasks
Set file attributes
Enable kernel debugging
Copy files
Compress or decompress files and directories
Echo the command/contents of a file
Set system date and time
Delete files
List files and directories
View events
Search files for a given string
Search files for a given string; Has advanced options than find command.
Windows batch command for looping
Find mac address of the system
Get system name
Logoff user session
Create directories
More command. Similar to Linux more command
Manage user accounts
Create/List/Delete network drives
Manage local computer’s user groups
Create / List/ Delete shares on the local computer
Edit/create/delete registry keys
Rename files
Rename directories
Delete directories
Copy large number of files/folders
Run an application as a different user in the same session
Schedule tasks
Shutdown computer
Shutdown remote computer
Command for sorting text files
Get computer information
List processes
Kill processes
Cat command for Windows. Prints the contents of file on command window
Copy files and directories

No comments:

Post a Comment