Okay.
So let's go ahead and take a spin around the PowerShell group policy module.
I'm going to go ahead and start PowerShell.
But when I do it, I'm going to run it as administrator because there are certain operations I'm going
to want to perform against GPOs that are going to need my full admin permission.
So I'm going to go ahead and do that in PowerShell.
V4, Microsoft introduced this concept that's sort of on demand module loading where you could type
the name of a command lit, and if the module wasn't already imported, you could it would automatically
imported by default.
But if you're not in that version, you can just type import module, name, group policy and the module
gets imported.
Now remember, I type get command module, group policy.
And it gives me a list of the command lists and aliases that are available in this module, in this
group policy module.
And so the simplest one that I'm going to start with is get GPO.
So get GPO, lets me get a reference to a group policy object.
So I'm going to typically I'm going to use the command lit tab completion to show you some of the parameters
that are available here.
So I can provide a name, I can provide a grid, I can provide a domain if I want to get access to GPOs
in different domains other than the one I'm currently in and I can tell it which server or DC I want
to connect to to get this information so I can specify a DC.
I can also with GPIO use the all parameter.
And what this is going to do if I hit enter is it returns a list of all the GPOs in my domain and you'll
see that it's got for a given GPO the display name, the domain name, the owner of the GPO, the grid
or ID of the GPO, the status of the GPO.
Any description which is the comment field created modified times and then the user and computer versions
and any WMI filters that might be linked to this GPO.
Now, if I wanted to just get information about one GPO, I could just type name and then lock down
policy, for example.
Or let's use the last one on the list, which is scripts policy, and I can go ahead and get scripts
policy.
I can also assign this to a variable.
So if I go to GPO equals get GPO name scripts policy then now dollar GPO represents this GPO and I can
do some modification on it.
So for example, you see the GPO status property here.
And remember I mentioned there is no direct conflict for modifying status.
But what if I do this?
So what if I said dollar, dollar, dollar, GPO, GPO status, it returns all settings enabled.
Now I happen to know that that's an enumeration that lists or that that contains all the possible values.
So if I were to say dollar GPO status equals zero and then go back and say dollar status, all settings
are disabled now.
And that's actually been changed in the GPO permanently.
You'll see here now that the property or the status on the GPO is set to disabled.
So I can make modifications to certain properties.
Not all properties are modifiable, but in that one, in that particular case it was.
So I was able to make a settings or status change to that GPO using PowerShell.
So there's a lot of flexibility in what you get with the PowerShell command lets and I'm going to talk
more about those and I wanted to just kind of introduce you to the module, get you familiar with some
of the basics and the get GPO Command Let is probably the most basic one you'll start with.