Solved

DHCP scope option reporting

Posted on 2010-08-12
6
496 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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

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!
Configuring network clients can be a chore, especially if there are a large number of them or a lot of itinerant users.  DHCP dynamically manages this process, much to the relief of users and administrators alike!
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

810 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