Archive for March, 2009

23
Mar
09

Windows XP: Change IP address (static DHCP) using command prompt

boom-main_fullThere are conflicts of IP addresses everywhere, most typical case would be home networking using DHCP and office network use Static IP due to security measurement. Switch them would be quite troublesome.

The harder way is to do it via command prompt. To change DHCP address to static IP:

netsh interface ip set address name=”<network connection name>” static <static IP> <network mask> <default gateway>

eg. netsh interface ip set address name=”Ethernet Network Connection” static 192.168.0.10 255.255.255.0 192.168.0.1

To change it back to DHCP client:

netsh interface ip set address name=”<network connection name>” dhcp

eg. netsh interface ip set address name=”Ethernet Network Connection” dhcp

Other than these, changing the DNS server manually would be:

netsh interface ip set dns name=”<network connection name>” static <DNS server IP address>

eg.netsh interface ip set dns name=”Ethernet Network Connection” static 192.168.0.1 (assume the gateway is same as DNS server)

Lastly, changing the WINS server manually would be:

netsh interface ip set wins name=”<network connection name>” static <DNS server IP address>

eg.netsh interface ip set wins name=”Ethernet Network Connection” static 192.168.0.1 (assume the gateway is same as WINS server)

Troublesome, isn’t it? What if you put all the commands into one batch file (.bat), with one click, it is easier than GUI!

Reference:

  1. Configure TCP/IP from the Command Prompt
  2. Microsft Help and Support:How to Use the NETSH Command to Change from Static IP Address to DHCP in Windows 2000
Advertisements
06
Mar
09

Export Group policy on a network

computergeek

For Microsoft computer network without Active Directory, deploying Group Policy is a nightmare as you definitely don’t want to get into Group Policy Object Editor and edit the option one-by-one on each PC.

This an alternative way to do so:

1. Open %systemroot%\system32\grouppolicy\ (eg. c:\WINDOWS\system32\GroupPolicy\)

2.Copy both “machine” and “user” folders to the “%systemroot%\system32\grouppolicy” – folder (same location) on the target machine.

3. Reboot or a “gpupdate /force” command to refresh the group policy.

Hereby I provide an example of batch file to do such jobs in one click.

First, you need to have both “machine” and “user” folders stored under a folder named “GroupPolicySource” (any filename as you like). Locate the batch file as in same folder with “GroupPolicySource” folder.

Batch file:

xcopy GroupPolicySource c:\WINDOWS\system32\GroupPolicy\ /s /e /y
gpdupate /f

or

xcopy GroupPolicySource c:\WINDOWS\system32\GroupPolicy\ /s /e /y
shutdown -r -i 5 (reboot in 5 seconds)

Reference:

  1. Florian’s Blog: How can I export local Group Policy settings made in gpedit.msc?
  2. XCOPY command reference