Getting a Bird’s Eye View of Your Group Memberships with PowerShell
Site migrations suck! And right now, I am stuck in the middle of one. This week, I was tasked with migrating applications and settings for 1,000 computers. Because our applications and settings are controlled through Group Policy (and scoped with security groups), we have a lot of groups that need to be matched and migrated.
Wanting to get a bird’s eye view of my group layout, I put together this script. It is still very much a work in progress but I hope it will help you in your own Active Directory/Group Policy cleanups or migrations.
Grabbing Our Data
This script starts by prompting you for a computer name. It will then use the Quest AD Cmdlets and find the OU that this machine is a member of. Next, it will grab every computer that is in that same OU.
Clear-Variable Groups -ErrorAction SilentlyContinue $SearchComputers = read-host "What is the computer name?" $Computers = Get-QADComputer *$SearchComputers* | Select-Object ParentContainer $Computers = Get-QADComputer -SearchRoot $Computers.ParentContainer | Sort-Object Name $SearchComputers = Get-QADComputer *$SearchComputers* | Select-Object ParentContainer $SearchComputers = $SearchComputers.ParentContainer



