Wednesday, January 26, 2011

windows command line tools

A good tutorial which i found on the net

Setting a static IP:
netsh interface ip set address name="Local Area Connection" static 172.16.3.4 255.255.0.0 1172.16.3.1 1

Setting up DNS:
set dns name="Local Area Connection" static 208.67.222.222 register=PRIMARY
add dns name="Local Area Connection" 208.67.200.200

Checking your config:
netsh interface ip show config

Saving all of your settings to a file:
netsh -c interface dump > filename1.txt

Using a file to set the config (Tw way to use this)
netsh -f filename2.txt
netsh exec filename2.txt

Setting up DHCP:
netsh interface ip set address name="Local Area Connection" dhcp
Then use ipconfig /release and ipconfig /renew

Stopping a service:
sc stop SNMP

Disabling a service
sc config SNMP start= disabled

remotely open files from your computer
net file

List all sessions connected to this machine
NET SESSION
NET SESSION \\ComputerName
NET SESSION /DELETE /y
NET SESSION \\ComputerName /DELETE

hostname
getmac

to shutdown a remote computer
shutdown -i
to cancel a scheduled shutdown
shutdown -a