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
DRRAMAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Steven CarnahanNetwork ManagerCommented:
Is this what you are looking for?  

http://powershell.com/cs/media/p/1714.aspx
0
DRRAMAuthor Commented:
I search for example:

Scope          Start IP Address          End IP Address
site1               18.180.1.1                         18.180.1.222
.....
......  
0
DRRAMAuthor Commented:
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
.....
......  
0
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

Steven CarnahanNetwork ManagerCommented:
You could look at Microsoft's powershell module for DHCP. http://gallery.technet.microsoft.com/scriptcenter/05b1d766-25a6-45cd-a0f1-8741ff6c04ec
0
Krzysztof PytkoSenior Active Directory EngineerCommented:
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
0
DRRAMAuthor Commented:
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
.....
......  
0
DRRAMAuthor Commented:
??????
0
DRRAMAuthor Commented:
???? I wait a solution
0
KenMcFCommented:
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/

0
DRRAMAuthor Commented:
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
0
KenMcFCommented:
Can you post a few examples of your scope names? Do they have spaces and dashes "-" in them?

0
DRRAMAuthor Commented:
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







0
KenMcFCommented:
We can fix this one
"AN/SITE 9 FSG-JOKSF_IJISD /SI .SG anglais"

by replacing this line

Add a space to the '-'
$l = $l -replace '-',','
$l = $l -replace " -",','


I am not sure about fixing this one, it looks like it is a limitation of netsh

I will try and see if there is another way to get this information, might be able to using WMI.






0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DRRAMAuthor Commented:
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
0
DRRAMAuthor Commented:
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
0
KenMcFCommented:
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.

0
DRRAMAuthor Commented:
Thanks and waiting for your kind reply as soon as possible
0
DRRAMAuthor Commented:
?
0
DRRAMAuthor Commented:
completly
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.