Enumerating the If... Then: Scripts

Tuesday, July 03, 2007

RealQuickScript: Batch-style Enabling Static / Enabling DHCP, DNS & IP, on an NIC

Tested.
In use at brother's work.


Set IP to static:
netsh interface ip set address name="Local Area Connection" static [IP Address] [Subnet Mask] [Gateway] 1
netsh interface ip set address name="Local Area Connection" static 192.168.4.131 255.255.255.0 192.168.4.1 1

Set DNS to static: (first lines is setting static and setting a primary DNS, second line is adding a DNS entry)
netsh interface ip set dns name="Local Area Connection" static 192.168.95.48
netsh interface ip add dns name="Local Area Connection" 192.168.95.48


Set IP to DHCP:
netsh interface ip set address name="Local Area Connection" dhcp

Set DNS to static:
netsh interface ip set dns name="Local Area Connection" dhcp

Usage:
Startup folder for a laptop with two logons. Combine with previous script to process with cached credentials. These things can also be performed with WMI.

Reasoning:
Allows user to connect on an IP restricted network (static IP) and home (DHCP).

0 Comments:

Post a Comment

<< Home