Purpose: Query all or some Active Directory Organisational Units and their LDAPs
Powershell has an enourmous amount of cmdlets, which can be called to do your bidding. In this scenario you want to list all your Acrive Directory Organizational Units and unleash some filters to that mass. There are many alternative ways to do this, select one of them below and have fun.
Usage: powershell.exe -ExecutionPolicy ByPass -file IT_AD_PS_GetAllOrganizationalUnits.ps1
Configuration: You can use filters to change the outcome of your query
References: Get-ADOrganizationalUnit, Export-Csv
Purpose: During a SCCM 2012 Computer Deployment, troubleshoot your AD permissions
Ok – before you start with all the “Hey dude, there is a built-in action to do this!” -talks, hear me out first. Remember all those SCCM Task Sequence changes you made? And then tried the Task Sequence out by installing an operating system? You noticed that you had problems getting a computer to move to the correct Active Directory (AD) Organisational Unit (OU)? Made some troubleshooting changes and then tried again? Here is where this script will come in handy! You do not need to run through the Task Sequence just to see if your computer will now actually move to the correct OU (because this can take an hour, right?). You could do a new Task Sequence, with only one action, just to test if your workstation moves around AD – but lets not stress that delicate System Center product with this. Most of the time problems with handling workstations in AD through SCCM are about permissions.
Usage: cscript.exe IT_OSD_VBS_MoveComputerADOU.vbs (no parameters exist)
Debugging: You can uncomment the msgbox rows, to see what values you are receiving.
Configuration: You need to change the AD OU location to suit your own environment.