Enable DHCP using GP...?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to enable DHCP on client PCs using Group Policy? (2000 or 2003
environment)
 
=?Utf-8?B?R3JlZ1c=?= said:
Is there a way to enable DHCP on client PCs using Group Policy? (2000 or
2003 environment)

You can assign a startup script via GPO to the computer objects that will
do this. I have done this on a network of about 600 PCs and it worked fine.
You will need the following in the batch file you assign as the startup
script.


REM Start Script

if not exist c:\dhcp.txt goto end

netsh interface ip set address "Local Area Connection" dhcp > c:\dhcp.txt
netsh interface ip set DNS "Local Area Connection" dhcp
netsh interface ip set WINS "Local Area Connection" dhcp

netsh interface ip set address "Local Area Connection 2" dhcp
netsh interface ip set DNS "Local Area Connection 2" dhcp
netsh interface ip set WINS "Local Area Connection 2" dhcp

netsh interface ip set address "Local Area Connection 3" dhcp
netsh interface ip set DNS "Local Area Connection 3" dhcp
netsh interface ip set WINS "Local Area Connection 3" dhcp

netsh interface ip set address "Local Area Connection 4" dhcp
netsh interface ip set DNS "Local Area Connection 4" dhcp
netsh interface ip set WINS "Local Area Connection 4" dhcp

:end

REM End script



The first line combined with the piping in the first netsh command ensures
that the script will only run once, making subsequent logins faster. If you
need to make the script run again for some reason, just delete the dhcp.txt
file on the users c: drive.
This will change the first 4 LAN adaptors to use DHCP. I really only needed
to hit the first 2 adaptors (most of our adaptors are called Local Area
Connection 2 because we build the machines from a ghost image which already
contains connection 1, then add the adaptor that actually exists on
the machine) but the script will handle up to 4. If you have more than
that, just add additional lines to the script. Any that don't exist just
error then continue on, but as it's running as a startup script the user
never sees the error.
 
there is a vbs script in the Windows 2000 resource kit that does this all
for you.

Philip Nunn
 
I have created the script via a GPO. I want it to run as a "shutdown"
procedure, which I have done so. When the script runs, it only changes
the IP address and not the Wins and DNS entries. It will work fine if I
try to run it locally on a system, but not through a Group Policy. Any
suggestions?

thanks..
 
Back
Top