Useful Windows Commands for VM Administrators

Over the course of my travels, I’ve found that having a quick reference to random Windows commands is helpful. Here are two sets of commands I use often enough to be useful, but not often enough that I’ve committed them to memory:

Managing IP Addresses from the CLI

Netsh! – This one predates PowerShell on Windows boxes, and went a long way to helping the everyday lives of Windows Admins.

Backup IP Address Config

netsh -c interface dump > c:\ip_address.txt

Restore IP Address Config

netsh -f c:\ip_address.txt

Set Interface to DHCP

netsh interface ip set address "Local Area Connection" dhcp
netsh interface ip set address "Local Area Connection" dhcp

Set Static IP Address

netsh interface ip set address name="Local Area Connection" static 192.168.0.100 255.255.255.0 192.168.0.1 1
netsh interface ip set dns "Local Area Connection" dhcp

Reset the TCP/IP Stack

netsh int ip reset all

Finding the Uptime of a Windows Box

Because you can not always plan on the presence of uptime.exe on a box, the following will get the info for you:

SystemInfo

systeminfo | more

Statistics

net statistics workstation

Sources:

2 thoughts on “Useful Windows Commands for VM Administrators

  • Don't forget that Windows has “findstr”, which is kind of like a designer imposter fragrance for the *nix “grep” utility.

    Here is how to get just what you want on those two uptime commands:

    SystemInfo:
    systeminfo | findstr /C:”System Up Time”

    Statistics:
    net statistics workstation | findstr since

    It may seem like a lot of typing but I can assure you that if you do this sort of thing often, it will become a habit.

    Good list of netsh commands though, I don't use netsh as much as I should.

Comments are closed.