Creating A Powershell Profile Script

Your Powershell profile is a .ps1 (Powershell script) that’s automatically run whenever you start a new Powershell command prompt.  You can do all sorts of customisation but possibly the best use for it is to add functions you’ve created yourself so they’re available at the command line.  This post shows how to create it.

First, you need to make sure the profile script exists. Type the following into Powershell;

$profile

This will return the full path to your profile file. You can then create new one by entering;

notepad $profile

Note that if the parent folder doesn’t already exist you may get an error. You can then create the parent path manually or try the following command;

New-Item -path $profile -type file -force

This creates a new file using the full path and forces the creation of parent folders if they don’t exist. You can then edit it with notepad as above.

I normally put functions in here to speed up logging onto Office 365 or Azure plus some handy helper functions I’ve written, but there’s all sorts of cool stuff you can do (see Technet for some examples).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s