Useful CMD commands

whoami /all #All info about me, take a look at the enabled tokens
whoami /priv #Show only privileges
net users #All users
dir /b /ad "C:\Users"
net user %username% #Info about a user (me)
net accounts #Information about password requirements
qwinsta #Anyone else logged in?
cmdkey /list #List credential
net user /add [username] [password] #Create user

#Lauch new cmd.exe with new creds (to impersonate in network)
runas /netonly /user<DOMAIN>\<NAME> "cmd.exe" ::The password will be prompted

#Check current logon session as administrator using logonsessions from sysinternals
logonsessions.exe
logonsessions64.exe
#Local
net localgroup #All available groups
net localgroup Administrators #Info about a group (admins)
net localgroup "Remote Management" [username] /add #Add user to Remote Management

#Domain
net group /domain #Info about domain groups
net group /domain <domain_group_name> #Users that belongs to the group

Last updated

Was this helpful?