Active Directory

Find all OU’s and what GPO’s are linked to them

/ / /

I made a script using SED and ADFIND to find all OU’s and what GPO’s were linked to them:

Love it 🙂

To expand on the above, here is a batch file that will find all empty OU’s and what GPO’s are linked to them:


Read More

Set home directories even if it’s a hidden share

/ / /

There exists an issue with DSMOD that prevents you from modifying the -hmdir with a share that has a dollar sign in it. According to the dsmod.exe example:

The special token $username$ (case insensitive) may be used to place the
SAM account name in the value of -webpg, -profile, -hmdir, and
-email parameter.
For example, if the target user DN is
CN=Jane Doe,CN=users,CN=microsoft,CN=com and the SAM account name
attribute is “janed,” the -hmdir parameter can have the following

-hmdir users$username$home

The value of the -hmdir parameter is modified to the following value:

– hmdir usersjanedhome

This does not work if your home directory is structured like so:

-hmdir users$$username$home

The value returned by DSMOD is actually:

– hmdir users$$username$home as opposed to the proper

To fix this you can use the awesome ADFIND and ADMOD from Joeware.

The command to fix set it correctly would be:

Go Joe!

Read More

AD Script to Link GPO’s via the command line

/ / /

I’ve modified a script I found online to allow standard batch file passthrough for linking a GPO to a OU.

Usage: cscript.exe linkGPO.vbs “Test GPO” “” “OU=AD Project,DC=lab,DC=com”


Read More