Windows CMD

root's picture

How to write a list of local users to a text file from command line (in the example below, the text will be created on the desktop - check the path):

C:\Users\Administrateur\Desktop>[color=blue]wmic useraccount list >userlist.txt[/color]

How to get network information (hostname, ip addresses, dns, etc):

C:\Users\dork>[color=green]ipconfig /all[/color]

Windows IP Configuration

   Host Name . . . . . . . . . . . . : GZDORK
   Primary Dns Suffix  . . . . . . . : gz.ro
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No
   DNS Suffix Search List. . . . . . : gz.ro

Ethernet adapter Production:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Network Connection
   Physical Address. . . . . . . . . : 00-0A-92-96-A3-6D
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   IPv4 Address. . . . . . . . . . . : 10.17.69.61(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 10.17.69.1
   DNS Servers . . . . . . . . . . . : 10.17.69.52
   NetBIOS over Tcpip. . . . . . . . : Disabled

How to get hard disk information:

C:\Users\dork>[color=green]wmic logicaldisk get size,freespace,caption[/color]
Caption  FreeSpace   Size
C:       9641156608  53684989952
D:       4927332352  32209104896

How to get memory size from windows command line with systeminfo or wmic:

C:\Users\dork>[color=green]systeminfo | findstr /c:"Total Physical Memory"[/color]
Total Physical Memory:     16,383 MB

C:\Users\dork>[color=green]wmic memorychip get capacity[/color]
Capacity
17179869184

How to login as another user in cmd (did it from cygwin):

C:\Users\gzuser>runas /user:gzuser@gzdomain cmd
Enter the password for gzuser@gzdomain:
Attempting to start cmd as user "gzuser@gzdomain" ...

How to get the AD groups with net user (will truncate the groups that are too long):

PS: /DOMAIN must be written as is.
\> net user /DOMAIN your_username

How to get the AD groups with gpresult (will not truncate the groups that are too long):

PS: /user must be written as is.
\> gpresult /user your_username /r

Thou shalt not steal!

If you want to use this information on your own website, please remember: by doing copy/paste entirely it is always stealing and you should be ashamed of yourself! Have at least the decency to create your own text and comments and run the commands on your own servers and provide your output, not what I did!

Or at least link back to this website.

Recent content

root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root