Windows – “no snap ins have been registered for powershell 4”

adfs2.0powershellpssnapinskewwindows

I have a Windows Server 2012 R2 Standard enabled with ADFS. I can open and use ADFS Management console. I am not sure which version of ADFS is installed on the server. As per Microsoft blogs Windows Server 2012 R2 comes with ADFS 2.0. I donot know how to confirm this.

Now I need to skew the ADFS clock by 2 minutes using the powershell ADFS snapin.
But when I try giving "get-pssnapin -registered" It doesnot list ADFS server.

Can anyone help me on how to execute the below commands on powershell:

Add-PSSnapin Microsoft.Adfs.PowerShell
Get-ADFSRelyingPartyTrust –identifier “urn:party:sso” | Set –NotBeforeSkew 2

Below is the error that I am getting:

PS C:\Users\manasa.pandiri> add-pssnapin microsoft.adfs.powershell
add-pssnapin : No snap-ins have been registered for Windows PowerShell version 4.
At line:1 char:1
+ add-pssnapin microsoft.adfs.powershell
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidArgument: (microsoft.adfs.powershell:String) [Add-PSSnapin], PSArgumentException
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

Best Answer

We also encountered this issue. Did a get-module -listavaiable and found that ADFS v1 was present. Next did a get-command -noun "ADFS" and it returned all the ADFS cmdlets. From there we issues the Set-ADFSRelyingPartTrust and was able to get the notBeforeShew set.

Related Topic