Sunday, April 29, 2007

PowerShell Profiles in Vista

To enable your PowerShell Profile file under Vista do the following
  1. Open a PS shell
  2. In the shell type $profile and then press Enter. This shows you the path to the profile file.
  3. Create the profile file. Type: new-item -path $profile -itemtype file -force
  4. In your new profile file enter a line like the following which is a shortcut for editing you new profile file: function pro { notepad $profile }
  5. Next enable execution of PowerShell scripts. Per default you cannot execute PowerShell scripts. Enabling scripts can be done with the following command: set-executionpolicy remotesigned. Under Vista this will only work if you run the PowerShell as an administrator.
  6. Open a new PowerShell and test your new function added previously: pro