Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Configuring DHCP information using Powershell

$
0
0

Hi there

I'm a bit of a newbie at PowerShell, and I wanted to ask if you guys could help me with a query I want to run.

Basically, I want to do the following:

1)Query a whole bunch of remote servers, getting their DHCP scope information.  I seem to be able to do this fine using a loop and the Get-DHCPServer4Scope

The result is something like this:

ScopeId         SubnetMask      Name           State    StartRange      EndRange        LeaseDuration               
-------         ----------      ----           -----    ----------      --------        -------------                
192.168.0.0     255.255.255.0   Clients        Active   192.168.0.11    192.168.0.20    8.00:00:00                   
192.168.2.0     255.255.255.0   clients2       Active   192.168.2.1     192.168.2.50    8.00:00:00 

2)The next bit I want is to get all the scope option parameters from the scopes I found above.  Now if I run this command:

Get-DhcpServerv4OptionValue -ComputerName -ScopeId 192.1.1.0, I get the following information which is good:

OptionId   Name            Type       Value                  
--------   ----            ----       -----                
51         Lease           DWord      {691200}                                                           
15         DNS Domain Name String     {xxx.com}                                                      
6          DNS Servers     IPv4Add... {192.168.0.1}

But how do I specify it that it gets ALL the ScopeIds, considering that I wouldn't know all their IDs if I automate it...

I've looked through examples, and they all seem to specify knowing the ScopeID itself.  There is a -all switch, but it doesn't seem to apply to this.

Any help would be appreciated!

Thanks


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>