Using ADFS Powershell Cmdlets

Managing AD FS 2.0 from a commandline is of course supported by a wealth of CmdLets, which you can read about here.

I had a bit of trouble getting started because these CmdLets require the use of a Powershell snap-in like so:

Add-PSSnapin Microsoft.Adfs.PowerShell

Here is a sample of the error thrown if you don’t add the snap-in and how it works:

Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.

PS C:\Users\lc> Get-ADFSRelyingPartyTrust -Name
The term ‘Get-ADFSRelyingPartyTrust’ is not recognized as the name of a cmdlet, function, script file, or operable prog
ram. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:26
+ Get-ADFSRelyingPartyTrust <<<<  -Name
    + CategoryInfo          : ObjectNotFound: (Get-ADFSRelyingPartyTrust:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\Users\lc> Add-PSSnapin Microsoft.Adfs.PowerShell
PS C:\Users\lc> Get-ADFSRelyingPartyTrust -Name

The Microsoft documentation for this is available here


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s