Select Page

Sometimes I’m reminded that, even though Microsoft has been shipping their Group Policy¬†PowerShell module for a while now, it is missing some key functionality. Fortunately, it took someone else asking me a question about how they could script something in PowerShell to realize that our SDM GPMC cmdlets, which have been around since about 2008, have a pretty good set of functionality even in the era of Microsoft’s own module! The question I had today was, “how can I script finding where GPOs are linked”? Sadly, the Microsoft module provides the verbs New-, Set- and Remove- against the GPLink noun, but they are missing a key one– Get-. Fortunately, the SDM GPMC cmdlets do include Get-SDMGPLink and it can be used in one of two ways. You can either feed it a Scope of Management (SOM), in the form of a LDAP distinguished name, like this:

Get-SDMGPLink -Scope "OU=Marketing,DC=cpandl,DC=com"

 

And it will return a list of GPOs linked to that SOM (i.e. OU or domain), like this:

Retrieving GPOs linked to a SOM

Or, you can feed the cmdlet a GPO Name, and have it return all the links for that GPO, like this:
Get-SDMGPLink -Name "GP Prefs"

With output that looks like this:

Retrieving GPO Links by GPO Name

So, either way you’re covered! And just a reminder, the current 1.3 version of the cmdlets were built for PowerShell 1.0, so they do not have a PowerShell 2.0 installer and associated module (we’re working on that!). In the meantime, you can still use these cmdlets in 2.0 by simply loading the module manually. Open up PowerShell, change directories to where the SDM GPMC cmdlets are usually installed (under C:Program FilesSDM SoftwareSDM Software GPMC Cmdlets, and type:

import-module -name .sdmgpocmdlets.dll

And you’re good to go!

 

Enjoy! — Darren