How To Create a PowerShell Profile

In this blog post, I will show you how to create a PowerShell profile and configure how PowerShell start and where.


PowerShell profiles are great for configuring PowerShell to take actions when we start the PowerShell console or ISE.

A profile is a PowerShell script that we can run PowerShell cmdlets that can do, for example:

  • Load modules
  • Change directory
  • Run script or cmdlets
  • Change Execution Policy

For a PowerShell profile to work, we need first to set the execution policy.

In my case and for simplicity, I will set it to unrestricted using the following cmdlet.

set-ExecutionPolicy Unrestricted

Create a Profile

To create a PowerShell profile, I will run the following cmdlet.

new-item $profile.CurrentUserAllHosts -ItemType file –Force

The cmdlet will create a profile.ps1 script in the following directory.

$home\"My Documents\windowspowershell"

From here, we can edit the script by adding cmdlet to it and save it.

When PowerShell starts the cmdlets in the script will run

ISE Profile

To set up a PowerShell profile for the ISE console, I will run the following cmdlets.

new-item $profile.CurrentUserAllHosts -ItemType file -Force
cd $home\"My Documents\windowspowershell"
New-Item -ItemType file microsoft.powershell.ise_profile.ps1 -Force

Edit Profile

To start PowerShell in the c:\ drive every time it starts, I will add the following cmdlet.

cd c:\

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.