Link to home
Start Free TrialLog in
Avatar of DRRAM
DRRAM

asked on

DHCP script

I have DHCP on windows 2008 R2
 Please I need a script that gives me as a result the name of scope and the START and END IP address of all scope in DHCP.
THX
Avatar of Steven Carnahan
Steven Carnahan
Flag of United States of America image

Is this what you are looking for?  

http://powershell.com/cs/media/p/1714.aspx
Avatar of DRRAM
DRRAM

ASKER

I search for example:

Scope          Start IP Address          End IP Address
site1               18.180.1.1                         18.180.1.222
.....
......  
Avatar of DRRAM

ASKER

I wait a response please

I search for example:

Scope          Start IP Address          End IP Address
site1               18.180.1.1                         18.180.1.222
.....
......  
I would use netsh utility with dhcp context on DHCP server.
Log on to your 2008R2 DHCP server and in command-line type

netsh dhcp server dump >c:\dhcp.log

and open this file in notepad. Look for "Add Scope" section. There are all scopes and below them you will find IP ranges for them

Regards,
Krzysztof
Avatar of DRRAM

ASKER

I wait a response please

I search only the three fields below

Scope          Start IP Address          End IP Address
site1               18.180.1.1                         18.180.1.222
.....
......  
Avatar of DRRAM

ASKER

??????
Avatar of DRRAM

ASKER

???? I wait a solution
Take a look at this blog post. This should give you the information you are looking and uses netsh like iSiek suggested but powershell to parse the output.

http://theadminguy.wordpress.com/2010/04/15/export-dhcp-scopes-and-their-address-pools-to-a-csv-file/

Avatar of DRRAM

ASKER

KenMcF
please
What can I change in the script so that I can export the full name of scope
because “Location” take the name of the scope with no spaces and not full name (except 13 characters)
I wait your response
thx
Can you post a few examples of your scope names? Do they have spaces and dashes "-" in them?

Avatar of DRRAM

ASKER

KenMcF
For example I have in the DHCP
Scope name : AN/SITE 9 FSG-JOKSF_IJISD /SI .SG anglais
After running the script -> the result in the file. csv
15.122.1.0,"255.255.255.224","15.122.1.20","15.122.1.33","AN/SITE9FSG"
comparing :
AN/SITE 9 FSG-JOKSF_IJISD /SI .SG anglais
AN/SITE9FSG

Other example:

Scope name : BU/Tut_Yurto/Qour_Tu_Mexic/Terfgytu
After running the script -> the result in the file. csv
15.122.55.0,"255.255.255.128","15.122.55.62","15.122.55.128","BU/Tut_Yurto/Qour_Tu_"
comparing :
BU/Tut_Yurto/Qour_Tu_Mexic/Terfgytu
BU/Tut_Yurto/Qour_Tu_

I wait your response
thx







ASKER CERTIFIED SOLUTION
Avatar of KenMcF
KenMcF
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of DRRAM

ASKER

KenMcF
please,
The only problem is: it does not give the full name of the scope
you will try if there is another way to get this information?
thx
Avatar of DRRAM

ASKER

please,,,??
The only problem is: it does not give the full name of the scope
you will try if there is another way to get this information?
thx
this looks to be a limitation of netsh. I have not been able to find another way to get this info. I will keep looking.

Avatar of DRRAM

ASKER

Thanks and waiting for your kind reply as soon as possible
Avatar of DRRAM

ASKER

?
Avatar of DRRAM

ASKER

completly