[Autogenerated] Imagine setting up multiple scopes or changing
scope options with just a single command.
Sounds good to me.
So let's dive in and this time we're going hands on to create
a brand new DH CP scope using PowerShell.
We'll add some exclusions to that scope.
So certain IP S are off limits,
then we'll dial in the lease duration because we certainly
don't want IP S sticking around forever.
And finally, we'll activate the scope to start serving addresses to clients.
So let's roll up our sleeves and get started.
All right, let's dive right in.
I'm here in my Windows 10 machine and I'm remote into
our server srv One first things first,
we need to check and see if there are any DH CP scopes
already that could conflict with our new setup.
So to do that, we'll use the get DH CP server V four scope command lit, right?
This command would show us all the I PV four scopes
currently configured in our D CV server.
But because there are none on here, we're starting from scratch.
We don't have any showing up.
We need to create a scope for the 1921681.0 network.
I don't see any existing scopes here at all that would
make and flick so we can go ahead.
So now let's roll up our sleeves and create a new DH CP scope.
So I'm going to define the scope parameters here using a PowerShell hash table.
I'm going to pass those parameters then to the A DH
CP server V four scopes command,
passing parameters to a command like this is called splatting.
And since I'm not doing this in any script editor,
we're just gonna be doing ad hoc commands.
I just copy and paste this right here inside of the console.
So I've now just defined and created a new DH CP scope with a
specific range of IP addresses and a subnet mask.
Now let's go ahead and set the lease duration for our scope.
The lease duration dictates how long an IP address is
reserved for a device once it's assigned.
So I'm going to set it for eight hours.
So I've now set the DC P server scope that we had
just created using the scope ID.
In this case, instead of the name,
the scope id is always going to be the network address
which is typically going to end with 0.0 and the lease
duration is set to eight hours now.
So setting an eight hour lease duration is usually a good practice
for environments like retail shops or for example,
where devices often connect and disconnect,
but we're not done yet,
we still need to activate our DC P scope to start dishing out those IP.
S let's use the set DC P server V four scope command lit again for this as well.
But now let's say that a client is getting an IP
that we need for a network printer.
We're going to set up, we need to exclude that IP address from being assigned.
So to do that, i'll use the A DH CP server V four exclusion range here,
I'm creating an array of IP si sometimes do that just
in case I need to add any more.
So with this code,
I could easily just add another one if I need to do another exclusion.
But since I'm only excluding a single IP,
I'm using that as the value for both the start range
and the in range here said in OK, let me take this back.
We cannot do this on this one because the start range and in
range do not support multiple IP addresses.
So let me just fix this again.
So we're going to change this to one dot 50 for the start range and in range and
voila forget what I just said about there with the excluded IP S so that
sometimes have it's a habit of mine because sometimes you can provide an array
of IP S an array of strings for a parameter.
In this case, PowerShell told you it can only set one IP per instance.
So now that I have that exclusion range set up.
I wanna go ahead and check the server scope.
So let's go ahead and move over here to the gooey on the actual server.
Just check for the exclusion range.
You come over here to address pools and now you can see that
192.168 at 1.50 is excluded from distribution.
So we have everything set up just great.
Ok.
So that wraps it up.
We've successfully set up the new DH GP scope.
We set an eight hour lease duration,
activated the scope and even excluded some IP S for
essential systems time for some action.
In this demo, we'll use PowerShell to set these key scope options,
making sure our clients get all the network configuration they need.
So I'm on my DC P server again,
SRV one and I'm going to configure some scope options
on our freshly created DH CP scope.
Let's first make sure it's still there.
Yep, there it is.
Let's start by configuring the router or the gateway option for our DH CP scope.
This option defines the default gateway for all the clients that
will use the set DH CP server V four option value,
command lit, that command lit is used to set the default gateway option,
which in this case is option is option ID three for our specified DH CP scope.
So I'll hit enter and look, looks like it worked.
Now, let's configure the DNS server options for our DH CP clients.
Ok.
Oh, darn it, it's, it failed.
All right.
It says 192.168 0.1 0.2 is not a valid DNS server.
Well,
that is correct because I do not have those in my
lab environment since the command.
It does have built in validation like that since I have this in my lab.
I right now I'm just doing it as a test.
I can use dash force to go ahead and override that validation.
Now, it should be working just fine.
Let's go ahead and check it just to make sure.
And it's not to get DH TP server V four scope command lit.
What it actually is is the GD AC P server V four option value command lit,
sign the scope ID and we now see the lease the router and
the DNA servers looks like it's there.
Let's make sure best thing option ID six and it's still hiding the
value so we can just pipe this to select object star.
And now we can see 1921681.2 and 1.3.
Yes, the DNS servers are finally set correctly.
All right.
So in this demo, everything looks good.
Now,
we have set some key scope options such as the router
and DNS servers all using PowerShell.