Solved

DHCP scope option reporting

Posted on 2010-08-12
6
499 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 43

Accepted Solution

by:
Steve Knight earned 500 total points
ID: 33427178
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
ID: 33693654
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
ID: 33697152
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
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 

Author Comment

by:SergeyGankin
ID: 33825917
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
ID: 33825932
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
ID: 33826224
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

Veeam gives away 10 full conference passes

Veeam is a VMworld 2017 US & Europe Platinum Sponsor. Enter the raffle to get the full conference pass. Pass includes the admission to all general and breakout sessions, VMware Hands-On Labs, Solutions Exchange, exclusive giveaways and the great VMworld Customer Appreciation Part

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever wondered why you had to use DHCP options (dhcp opt 60, 66 or 67) in order to use PXE? Well, you don't!
Learn how to PXE Boot both BIOS & UEFI machines with DHCP Policies and Custom Vendor Classes
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

627 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