Sign in
Home
Library
Wiki
Learn
Gallery
Downloads
Support
Forums
Blogs
Resources For IT Professionals
United States (English)
Россия (Pусский)
中国(简体中文)
Brasil (Português)
Post an article
Translate this page
Powered by
Microsoft® Translator
Wikis - Page Details
First published by
Adam Conkle - MSFT
(Microsoft)
When:
1 Sep 2011 8:19 AM
Last revision by
Richard Mueller
(MVP, Microsoft Community Contributor)
When:
22 Feb 2013 11:26 AM
Revisions:
4
Comments:
2
Options
Subscribe to Article (RSS)
Share this
Can You Improve This Article?
Positively!
Click Sign In to add the tip, solution, correction or comment that will help other users.
Report inappropriate content using
these instructions
.
Wiki
>
TechNet Articles
>
AD FS 2.0: How to Automatically Add the AD FS 2.0 Powershell Snap-in When Launching Powershell
AD FS 2.0: How to Automatically Add the AD FS 2.0 Powershell Snap-in When Launching Powershell
Article
History
AD FS 2.0: How to Automatically Add the AD FS 2.0 Powershell Snap-in When Launching Powershell
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.
Ove
rview
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
1. Launch a PowerShell console window
2. 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
3. Execute the following command:
$PROFILE
4. Take note of the path from step 3. It should be similar to the following:
C:\Users\<username>\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
5. 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.
6. Edit Microsoft.PowerShell_profile.ps1 in your favorite text editor, and add the following line:
Add-PsSnapin Microsoft.Adfs.PowerShell -ErrorAction SilentlyContinue
7. Save and Close Microsoft.PowerShell_profile.ps1, and close any open PowerShell console windows
8. Launch a PowerShell console window and test the solution by executing the following command:
Get-Command *ADFS*
$profile
,
AD FS
,
AD FS 2.0
,
AD FS v2
,
adfs
,
ADFS 2.0
,
ADFS v2
,
automate
,
Automatically
,
Console
,
en-US
,
load
,
Microsoft.PowerShell_profile.ps1
,
PowerShell
,
profile
,
ps1
,
script
,
snapin
,
snap-in
,
Windows PowerShell V3