[Autogenerated] Before we dive into our demo,
let's equipped ourselves with the right tools.
First up is add DNS server resource record.
This is the command you'll use to create new records.
Then we have get D NSS server resource records like you use in the first demo.
This command lets you view existing records,
sort of like a magnifying glass for your DNS landscape.
And finally, we have remove DNS server resource record.
This is your eraser,
your cleanup crew for when you need to delete the DNS record.
All right, ready for some more hands-on action in our upcoming demo.
We're simulating a real world scenario here.
Let's say a company just launched a new website and an email service and
you need to set up a temporary DNS solution for it.
We'll start by adding an, a record for the website.
This is the address folks will type into their browser
so it needs to be set up correctly.
We'll then set up a cname record which the company wants as a promotional
subdomain and they will configure an MX record too to make sure that the emails
go where they're supposed to for this new promo domain.
Finally we'll remove the cname and MX records demonstrating just
how to clean up once a promotional campaign ends,
I'm remoting into my DNS server again here.
So let's kick this off by first adding an A record for our new products website.
The A DNS server resource record,
a command should have now created an A record called new product.
And that record should be mapped to an IP address at 192.168 0.1
0.100 the DNS zps for sys at mas dot local.
Now to confirm the A record was created successfully,
let's check with G DNS server resource record.
All right, we'll get a response and the IP address looks correct,
but I'm still not convinced.
Let's test to see if that record is actually resolving
at the client using resolve DNS name.
So to resolve the client, I'm here on SRV one on my server.
So I will come back here to my Windows 10 machine and then
I will run resolve D NS name to resolve the name from the
client and see if that works.
All right, great.
It looks like it's resolving correctly.
Notice that the record name is correctly pointing
to the IP address I provided it.
Now, let's go back into the DNS server again.
Now,
we need to create a CNAME record for a promotional subdomain
that points to the new product record.
We just created using a CNAME record.
We can point clients to a different name to resolve this works well,
when you need to set up a temporary name like we're doing in this demo,
I will create a cname record called promo and I will point that
record to the new product record we just created.
So it looks like that worked using the A DNS server resource record,
cname command lit.
And now let me see if that name is resolving again.
This time, i'll just test the resolution from the SRV one server itself.
All right, that looks great.
The promo name is successfully pointing to the new product,
a record now onto the MX record for our email service MX records,
direct email to a particular email server.
Now let's create an MX record for all email destined for the PS four systems,
mens dot local domain to use our mail server at mail
dot PS sys for sysadmins dot local.
That has an A record already set up for it.
All right, looks like that works using a DNS server resource record MX.
The name of at represents all records for the PS for sys dot local domain.
And the preference primer defines the MX priority in case you
have multiple mail servers for the same domain.
So it looks like it was successful, no errors, which is always a good thing.
Let's go ahead and resolve that again.
You guessed it with resolve dean S name.
And this time we can use the type parameter of resolve D NS
names to only look for a particular type.
In this case,
we are checking for the Imex record for PS for Syms dot local and it looks
like it's working as expected is exactly what it should be.
Now note that before I wasn't using the type parameter.
That's because by default, it does look for only a records.
Now, everything is set up.
Let's fast forward a few days and oh man, the promotion has ended.
Let's go ahead and clean everything up.
This is where PowerShell Excels since you know exactly what you
created before you can create a simple removal script.
So here you can see a few commands.
I've copied this directly into the console to make it easier to demonstrate.
But if you were running this in the real world,
you would probably just create a PS ONE script and save it
in there and write it from that way.
But same difference.
So here this script is querying for all the records we did before to verify
them and putting them all in an array called records.
Now, everything should be in that records.
Variable.
Let's check.
Yep, looks good.
There's the C name, the MX and the A record.
Now, once they're all in an array, you can remove all of them with a single line.
Oh Man, I'm getting prompted to confirm this isn't automation.
Let me cancel this and try something else.
I will add the force parameter to the end,
the force parameter is a common parameter.
Many command lets have that allow you to silence that confirmation prompt.
Now, in the power show world,
you can also do something like confirm colon false
and that works on some commands, but it doesn't work on this one.
It's kind of a hit and miss sometimes.
So Fy I, so let's use the force parameter and see what happens.
No errors, no confirmation.
That's a good sign.
So there you have it.
We have just set up and managed some real world DNS records.
You added an A record, set up AC NM record and configured an MS record.
We verified each one and cleaned them all up, completing the lifecycle.