Solved

DHCP scope option reporting

Posted on 2010-08-12
6
495 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
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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 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

22 Experts available now in Live!

Get 1:1 Help Now