In this post I want to share small tip which will help you to run Sharepoint management console (or management shell) in any custom folder. If you work with automatization of Sharepoint administrative tasks with PowerShell, then this tip may be helpful for you. The problem is that when you run OTB Sharepoint management console in runs in default home folder (e.g. “c:\users\myuser”). But in real life you may need to reopen it frequently (e.g. if you consume some code written on C# in assembly which is located in GAC. If this code is changed you need to reinstall assembly into GAC. Also if you want your changes to affect management console you need to reopen it because otherwise console will use old cached version of the assembly). After restart console will be again use default location, so you will need again perform “cd c:/projects/myscripts” command in order to go to the folder with your scripts.
In order to avoid this, go to the folder “ C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\Registration” and edit “SharePoint.ps1” file. Find the following line:
and replace $home with your folder:
After that once you will start Sharepoint management console – it will be launched in your folder and you will be able to start working with your scripts immediately. But note that this change will affect all users of the management console, so I recommend to revert changes when you will finish your development.