Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
If you often administer your AD FS 2.0 Federation Service using PowerShell, there is an easy way to automatically add the AD FS 2.0 PowerShell snap-in when the PowerShell console window is launched.
Overview
PowerShell loads a profile for the user when the console window is launched. We will be creating and modifying this PowerShell profile in order to automatically add the AD FS 2.0 PowerShell snap-in each time PowerShell is launched.
Steps
Launch a PowerShell console window
We must allow the execution of scripts on the system. The following command will achieve this:
Set-ExecutionPolicy
Options
Unrestricted, RemoteSigned, AllSigned, Restricted, Default, Bypass, Undefined
Example
Set-ExecutionPolicy Unrestricted
Execute the following command:
$PROFILE
Take note of the path from step 3. It should be similar to the following:
Create any needed directories and files needed to satisfy the profile path. For example, the WindowsPowerShell directory and Microsoft.PowerShell_profile.ps1 file do not exist by default.
Edit Microsoft.PowerShell_profile.ps1 in your favorite text editor, and add the following line:
Add-PsSnapin Microsoft.Adfs.PowerShell -ErrorAction SilentlyContinue
Save and Close Microsoft.PowerShell_profile.ps1, and close any open PowerShell console windows
Launch a PowerShell console window and test the solution by executing the following command:
Get-Command *ADFS*