Cool Windows Commands I’ve Been Using Lately

Set Static IP Via cmd

I’ve found this command useful for testing purposes.

netsh interface ipv4 set address name=[interfacename] static [myip] [subnetmask] [gateway]

netsh interface ipv4 set address name=[interfacename] dhcp

Examples:

  1. netsh interface ipv4 set address name=”local area connection” static 172.16.2.8 255.255.0.0 172.16.2.254
  2. netsh interface ipv4 set address name=”wireless network connection” dhcp
  3. netsh interface ipv4 set dnsservers name=”wireless network connection” static 10.0.0.1 primary
  4. netsh interface ipv4 set dnsservers name=”wireless network connection” dhcp

Check Who’s Logged in on Server

This allows you to check if anyone’s rdp-ed into a server before logging into it to avoid booting someone off (open cmd as administrator).

Qwinsta /server:[servername]

Check OU a Computer is stored under in Active Directory

Outputs the OU a computer is stored under.

dsquery computer -name [computername]

Copy output of command to clipboard

Pipe a command into “clip”

Examples:

  1. ipconfig /all | clip
  2. echo “Purple Monkey Dish Washer” | clip

Open notepad to scribble a note very fast

Not really a command, but very useful anyhow when you need to jot down a detail or copy something from the clipboard somewhere temporarily.

Hit “Windows Key + R”, type “notepad” and hit enter. Starts nearly instantly and lets you type a note, phone number etc.

Append text to file

To add content to the end of a file, or create and add content to a file if it doesn’t exist, put “>> [filename]” after a command to copy the output to a file.

echo %computername% >> c:\myfile.txt

ipconfig /all >> c:\myfile.txt

ipconfig /displaydns>> c:\myfile.txt

Get the MAC address of a remote computer

Returns the MAC address of a computer

getmac /s [computername]

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: