[OT] Command to set a PC to DHCP?

Todd Caughey wrote:
> Thanks for the tips. Yes, I was not planning on doing this on any servers. We use a 255.255.255.0 subnet so.... for the 255 or so addresses I was planning on 1-35 being static gateway router and servers, 36-50 shop floor DC PCs as static,51-101 other static devices, 102-199 DHCP scope (for 50 PCs) and 200-230 static printers.

IP addresses are binary, so if you want to group things as you suggest,
you should use binary rather than 10-based boundaries.

For example, your static devices could use the space 0 - 31 (lower most
5 bits significant), and can be identified with a subnet mask of
255.255.255.224 or /27 in CIDR notation. A lot of sites use the class-A
sized 10.x.x.x block which gives you more addresses than you could ever
use and lets you easily divide things, like 10.0.0.x for servers,
10.0.1.x for normal workstations, 10.0.2.x for restricted devices, etc.

-Wayne
I have finally turned on a DHCP scope for our network and will need to set every PC to automatically obtain an address rather than have a static address. Is there any command line command that will change a PC to DHCP? If so I could distribute a batch file and let the users do their own PC rather than run all over changing them. I realize some users may not have privilage levels to do this but many do and it would save me a lot of time. Any of you network gurus know if this is even possible?

Thanks,
Todd Caughey
Harvey Vogel Mfg. Co.


[Non-text portions of this message have been removed]
netsh interface ip set address "Local Area Connection" dhcp

It all depend on what the network connection is though. Normally is
Local Area Connection but sometimes it may have a number after it.

--- In vantage@yahoogroups.com, Todd Caughey <caugheyt@...> wrote:
>
> I have finally turned on a DHCP scope for our network and will
need to set every PC to automatically obtain an address rather than
have a static address. Is there any command line command that will
change a PC to DHCP? If so I could distribute a batch file and let
the users do their own PC rather than run all over changing them. I
realize some users may not have privilage levels to do this but many
do and it would save me a lot of time. Any of you network gurus
know if this is even possible?
>
> Thanks,
> Todd Caughey
> Harvey Vogel Mfg. Co.
>
>
> [Non-text portions of this message have been removed]
>
I had to make a small tweak but it seems to work great.
I used:
netsh interface ip set address "Local Area Connection" source=dhcp

It wanted the "source=" before the dhcp. This was on Xp-Sp3. I need to check a couple other OS flavors (sp2 and win2k) but I think this will be fine. Thanks for putting me on the right track.
-Todd C.


________________________________
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of Michael McWilliams
Sent: Thursday, June 19, 2008 9:06 AM
To: vantage@yahoogroups.com
Subject: [Vantage] Re: [OT] Command to set a PC to DHCP?


netsh interface ip set address "Local Area Connection" dhcp

It all depend on what the network connection is though. Normally is
Local Area Connection but sometimes it may have a number after it.

--- In vantage@yahoogroups.com<mailto:vantage%40yahoogroups.com>, Todd Caughey <caugheyt@...> wrote:
>
> I have finally turned on a DHCP scope for our network and will
need to set every PC to automatically obtain an address rather than
have a static address. Is there any command line command that will
change a PC to DHCP? If so I could distribute a batch file and let
the users do their own PC rather than run all over changing them. I
realize some users may not have privilage levels to do this but many
do and it would save me a lot of time. Any of you network gurus
know if this is even possible?
>
> Thanks,
> Todd Caughey
> Harvey Vogel Mfg. Co.
>
>
> [Non-text portions of this message have been removed]
>





[Non-text portions of this message have been removed]
netsh interface ip set address * source=dhcp

That *might* make the command apply to all network interfaces within a
given computer (it works with "ipconfig" commands). Be careful, though,
that your script doesn't ever run on a server - that would be
disastrous. As a precaution in the past, I've assigned
static-reservations for server IPs even though they were set to be
static, *just in case* one of my admins got careless...

By the way - once you start using DHCP, there are some really fun things
you can do with assigning "classes" to machines and setting different
options for routers/DNS servers/gateways/etc. At the same time, there
are some DHCP-setup "gotcha's" you might want to watch out for,
particularly with regard to getting machines properly registered in DNS
(forward and reverse lookup zones).

--Ari

________________________________

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of Todd Caughey
Sent: Thursday, June 19, 2008 9:46 AM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] Re: [OT] Command to set a PC to DHCP?



I had to make a small tweak but it seems to work great.
I used:
netsh interface ip set address "Local Area Connection" source=dhcp

It wanted the "source=" before the dhcp. This was on Xp-Sp3. I need to
check a couple other OS flavors (sp2 and win2k) but I think this will be
fine. Thanks for putting me on the right track.
-Todd C.

________________________________
From: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
[mailto:vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ] On
Behalf Of Michael McWilliams
Sent: Thursday, June 19, 2008 9:06 AM
To: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
Subject: [Vantage] Re: [OT] Command to set a PC to DHCP?

netsh interface ip set address "Local Area Connection" dhcp

It all depend on what the network connection is though. Normally is
Local Area Connection but sometimes it may have a number after it.

--- In vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
<mailto:vantage%40yahoogroups.com>, Todd Caughey <caugheyt@...> wrote:
>
> I have finally turned on a DHCP scope for our network and will
need to set every PC to automatically obtain an address rather than
have a static address. Is there any command line command that will
change a PC to DHCP? If so I could distribute a batch file and let
the users do their own PC rather than run all over changing them. I
realize some users may not have privilage levels to do this but many
do and it would save me a lot of time. Any of you network gurus
know if this is even possible?
>
> Thanks,
> Todd Caughey
> Harvey Vogel Mfg. Co.
>
>
> [Non-text portions of this message have been removed]
>

[Non-text portions of this message have been removed]






[Non-text portions of this message have been removed]
Thanks for the tips. Yes, I was not planning on doing this on any servers. We use a 255.255.255.0 subnet so.... for the 255 or so addresses I was planning on 1-35 being static gateway router and servers, 36-50 shop floor DC PCs as static,51-101 other static devices, 102-199 DHCP scope (for 50 PCs) and 200-230 static printers. Above that are some odd CNC mills that are also static. I like the idea for the static reservations for the servers, even if I'm the only admin.

So far the batch file works on all the PCs except Win98 (as expected) which will mostly be static anyway.

-Todd C.

________________________________
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of Ari Footlik
Sent: Thursday, June 19, 2008 10:15 AM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] Re: [OT] Command to set a PC to DHCP?


netsh interface ip set address * source=dhcp

That *might* make the command apply to all network interfaces within a
given computer (it works with "ipconfig" commands). Be careful, though,
that your script doesn't ever run on a server - that would be
disastrous. As a precaution in the past, I've assigned
static-reservations for server IPs even though they were set to be
static, *just in case* one of my admins got careless...

By the way - once you start using DHCP, there are some really fun things
you can do with assigning "classes" to machines and setting different
options for routers/DNS servers/gateways/etc. At the same time, there
are some DHCP-setup "gotcha's" you might want to watch out for,
particularly with regard to getting machines properly registered in DNS
(forward and reverse lookup zones).

--Ari

________________________________

From: vantage@yahoogroups.com<mailto:vantage%40yahoogroups.com> [mailto:vantage@yahoogroups.com<mailto:vantage%40yahoogroups.com>] On Behalf
Of Todd Caughey
Sent: Thursday, June 19, 2008 9:46 AM
To: vantage@yahoogroups.com<mailto:vantage%40yahoogroups.com>
Subject: RE: [Vantage] Re: [OT] Command to set a PC to DHCP?

I had to make a small tweak but it seems to work great.
I used:
netsh interface ip set address "Local Area Connection" source=dhcp

It wanted the "source=" before the dhcp. This was on Xp-Sp3. I need to
check a couple other OS flavors (sp2 and win2k) but I think this will be
fine. Thanks for putting me on the right track.
-Todd C.

________________________________
From: vantage@yahoogroups.com<mailto:vantage%40yahoogroups.com> <mailto:vantage%40yahoogroups.com>
[mailto:vantage@yahoogroups.com<mailto:vantage%40yahoogroups.com> <mailto:vantage%40yahoogroups.com> ] On
Behalf Of Michael McWilliams
Sent: Thursday, June 19, 2008 9:06 AM
To: vantage@yahoogroups.com<mailto:vantage%40yahoogroups.com> <mailto:vantage%40yahoogroups.com>
Subject: [Vantage] Re: [OT] Command to set a PC to DHCP?

netsh interface ip set address "Local Area Connection" dhcp

It all depend on what the network connection is though. Normally is
Local Area Connection but sometimes it may have a number after it.

--- In vantage@yahoogroups.com<mailto:vantage%40yahoogroups.com> <mailto:vantage%40yahoogroups.com>
<mailto:vantage%40yahoogroups.com>, Todd Caughey <caugheyt@...> wrote:
>
> I have finally turned on a DHCP scope for our network and will
need to set every PC to automatically obtain an address rather than
have a static address. Is there any command line command that will
change a PC to DHCP? If so I could distribute a batch file and let
the users do their own PC rather than run all over changing them. I
realize some users may not have privilage levels to do this but many
do and it would save me a lot of time. Any of you network gurus
know if this is even possible?
>
> Thanks,
> Todd Caughey
> Harvey Vogel Mfg. Co.
>
>
> [Non-text portions of this message have been removed]
>

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]





[Non-text portions of this message have been removed]