Takes the OU of an EWS computer lab and adds sub-OUs and links existing GPOs to refactor for standardized remote desktop access,.
Full documentation is at https://uofi.atlassian.net/wiki/spaces/engritinstruction/pages/36191924/EWS+remote+access+to+Windows+labs
- Download
LabCheckProvision-LabOU.psm1
to$HOME\Documents\WindowsPowerShell\Modules\LabCheckProvision-LabOU\LabCheckProvision-LabOU.psm1
.- The module is now already available for use with your regular account, however it needs to modify AD objects which likely only your SU account will have access to.
- Make the module available as your SU account: see here.
- Run it using the provided examples and documentation below.
The following actions can be specified via the associated parameter:
- Provision
- Deprovision
Only one action can be specified at a time. The steps each action takes are documented below.
Required string.
The distinguished name of the parent lab OU on which to take action.
Optional switch.
Provisions the given parent lab OU for remote access.
When specifying the -Provision
parameter:
- A
RemoteEnabled
OU is created under the given parent lab OU. - A
LocalLoginDisabled
OU is created under the newRemoteEnabled
OU. - The GPO named
ENGR EWS RDU <lab-name>
is linked to theRemoteEnabled
OU if such a GPO exists. The GPO must be manually created beforehand.<lab-name>
must exactly mirror the name of the given parent OU. - The existing GPO named
ENGR EWS Restrict local login to admins
is linked to theLocalLoginDisabled
OU.
Example:
LabCheckProvision-LabOU -Provision -LabOudn "OU=ECEB-9999,OU=EWS,OU=Instructional,OU=Desktops,OU=Engineering,OU=Urbana,DC=ad,DC=uillinois,DC=edu"
Optional switch.
Deprovisions the given parent lab OU for remote access.
The given parent lab OU must be provisioned, and all AD objects (computer, users, groups, OUs, etc.) must be moved out of the RemoteEnabled
and LocalLoginDisabled
sub-OUs first.
When specifying the -Deprovision
parameter:
- A check is made to see if any AD objects exist in the
RemoteEnabled
orLocalLoginDisabled
sub-OUs of the given lab OU. If any objects exist in these OUs, the script simply exits without making any changes. If no objects are found then... - The
LocalLoginDisabled
OU is removed (along with all GPO links to it). - The
RemoteEnabled
OU is removed (along with all GPO links to it).
Example:
LabCheckProvision-LabOU -Deprovision -LabOudn "OU=ECEB-9999,OU=EWS,OU=Instructional,OU=Desktops,OU=Engineering,OU=Urbana,DC=ad,DC=uillinois,DC=edu"
Optional switch.
Runs through the given action as normal, except all changes to AD are skipped.
Example:
LabCheckProvision-LabOU -TestRun -Provision -LabOudn "OU=ECEB-9999,OU=EWS,OU=Instructional,OU=Desktops,OU=Engineering,OU=Urbana,DC=ad,DC=uillinois,DC=edu"
Optional integer.
Number of seconds that the script waits between creating an OU and linking GPOs to it.
This allows time for changes to sync to the domain controllers, so that the script doesn't end up trying to do things like link a GPO to a newly-created OU that hasn't been replicated yet.
Default is 30
.
- By mseng3. See my other projects here: https://github.com/mmseng/code-compendium.