
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:
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:
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
8
JUN
JUN









About the Author:
Darren Mar-Elia is CTO & Founder of SDM Software, Inc. Darren has over 25 years of IT and Software experience in the Microsoft technology area, including serving as a Director in Infrastructure at Charles Schwab, CTO of Windows Management Solutions at Quest Software, and Sr. Director of Product Engineering at DesktopStandard. He has been a Microsoft MVP in Group Policy technology for the last 6 years and has written and spoken on Active Directory, Group Policy and PowerShell topics frequently over the years. He maintains the popular Group Policy resource web site at www.gpoguy.com and has been a contributing editor for Windows IT Pro Magazine since 1997. He has written and contributed to twelve books on Windows. Darren also speaks frequently at conferences on Windows infrastructure topics.