Solved

DHCP scope option reporting

Posted on 2010-08-12
6
494 Views
Last Modified: 2012-05-10
Dear Experts,

Is there any code available, which would allow me to pull the value of a specific DHCP scope option, rather than listing them all, as "netsh dhcp server scope <IP> show optionvalue" does?

Thank you,

Sergey
0
Comment
Question by:SergeyGankin
  • 3
  • 3
6 Comments
 
LVL 43

Accepted Solution

by:
Steve Knight earned 500 total points
Comment Utility
Not with the the NETSH command afaik.

You can soon run that through a FIND or FINDSTR command, e.g.

netsh dhcp server scope <IP> show optionvalue | find "optionvalue 3 "

Should bring back the default gateway line (from memory.. I thibk that was 3!)

You could use a FOR command then if necesssary to split of the value from this line:

@echo off
for /f "tokens=3,5,8,10* delims= " %%a in ('type irn70136.txt ^| find "optionvalue 3 "') do (
   echo Server = %%a
   echo Scope = %%b
   echo Option %%c = %%d
)

Steve
0
 

Author Comment

by:SergeyGankin
Comment Utility
did not quite narrow it down to the right text, but thank you for the suggestion, it was helpful. perhaps i just need to play with it a while.
0
 
LVL 43

Expert Comment

by:Steve Knight
Comment Utility
Please let me know what you have as a script now and what output you are/aren't getting and will see what can be done.  Give me the output of

netsh dhcp server scope x.x.x.x show optionvalue

with any details amended if you wish and what you want out of it - could be you get subtly different output to the script above which is part of one for pullng the details out of a Server 2003 network.
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:SergeyGankin
Comment Utility
Hello dragon-it,

I was not able to get separate output for each individual DHCP cope option. However, using the following type of code allows for manageable output parsing:

        Set objWshScriptExec = objShell.Exec(strQuery)
        Set objStdOut = objWshScriptExec.StdOut

        Do Until objStdOut.AtEndOfStream

              strLine = objStdOut.ReadLine
             
        Loop

Thank you for your help.

Best Regards,

Sergey
0
 

Author Closing Comment

by:SergeyGankin
Comment Utility
Did not completely resolve my issue, but was quite helpful at pointing me in the right direction.
0
 
LVL 43

Expert Comment

by:Steve Knight
Comment Utility
Fair enough.  Would gladly of assisted more if given the chance (and an example of the failing output). Batch text parsing can be a little tricky but should work as long as the input formats are known.

Steve
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Ever wondered why you had to use DHCP options (dhcp opt 60, 66 or 67) in order to use PXE? Well, you don't!
A Cisco router can be configured as a DHCP Server. There are advantages and disadvantages in making your Cisco router work as DHCP Server. Almost all the features for windows DHCP can be configured on Cisco-based DHCP server. Some of the features me…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now