Understanding the Six PowerShell Profiles

Summary: Microsoft Scripting Guy, Ed Wilson, discusses the six different Windows PowerShell profiles, and when to use each.

Hey, Scripting Guy! Question Hey, Scripting Guy! Dude, I have been reading some of the posts in your most excellent blog; and first of all, I want to say I think you are great. Now for the question: I do not get the Windows PowerShell profile. I mean I get it, but not really. Here is part of my problem. I put some things in the profile, and then I go back and they are not there. Like, what is up with that? I hope you can help me. By the way, I am, like, totally looking forward to seeing you and the Scripting Wife at TechEd 2012 in Orlando. You will know me, because I sort of look like Urkel, and I always wear plaid shirts (but I don’t wear suspenders).


Hey, Scripting Guy! Answer Hello BB,

Microsoft Scripting Guy, Ed Wilson, is here. Last week was an absolutely great week. The Scripting Wife and I had dinner one night with Rich from the NYC Windows PowerShell Users Group (he is also a moderator for the Scripting Guys forum and writer of a couple of guest blogs). Rich was kind enough to bring me some Gunpower green tea, and I am sipping some right now. It is wonderful with a half teaspoon of organic lavender added to the pot. We also had the PowerScripting Podcast with the two winners of the 2012 Scripting Games and Jeffrey Snover. That conversation was fun and informative. I also enjoy talking to Jeffrey, and I look forward to sitting-in on at least one of his sessions at Microsoft TechEd 2012.

Six, count ‘em, six different PowerShell profiles

BB, there is no doubt that you are a bit confused with Windows PowerShell profiles. There are, in fact, six different profiles. The Windows PowerShell console and the Windows PowerShell ISE have their own profiles. In addition, there are profiles for the current user and profiles for all users. The table that follows lists the six profiles and their associated locations.



Current User, Current Host - console

$Home\[My ]Documents\WindowsPowerShell\Profile.ps1

Current User, All Hosts   

$Home\[My ]Documents\Profile.ps1

All Users, Current Host - console   


All Users, All Hosts      


Current user, Current Host - ISE

$Home\[My ]Documents\WindowsPowerShell\Microsoft.P owerShellISE_profile.ps1

 All users, Current Host - ISE  



Understanding the six Windows PowerShell profiles

The first thing to do to understand the six Windows PowerShell profiles is to keep in mind that they move. They change (sort of like the staircases at Hogwarts). As long as you realize that they are a moving target, you will be fine. In most cases, when talking about the Windows PowerShell profile, people are referring to the current user, current host profile. In fact, if no one qualifies the Windows PowerShell profile with its associated scope or description, it is safe to assume that they are talking about the Current User, Current Host profile.

Note   A Windows PowerShell profile (any one of the six) is simply a Windows PowerShell script. It has a special name, and it resides in a special place, but it is simply a script. In this regard, it is sort of like the old-fashioned autoexec.bat batch file. Because the Windows PowerShell profile is a Windows PowerShell script, you must enable the Script Execution policy prior to configuring and using a Windows PowerShell profile. For information about the Script Execution policy refer to this collection of Hey, Scripting Guy! Blogs.

Examining the $profile variable

When you query the $profile automatic variable, it returns the path to the Current User, Current Host profile. This makes sense, and it is a great way to easily access the path to the profile. The following script illustrates this technique from within the Windows PowerShell console.

PS C:\> $profile


Inside the Windows PowerShell ISE, when I query the $profile automatic variable, I receive the output that is shown here.

PS C:\Users\ed.IAMMRED> $profile


To save you a bit of analyzing…

The difference between the Windows PowerShell console Current User, Current Host profile path and the Windows PowerShell ISE Current User, Current Host profile path is three letters: ISE.

BB, these three letters are probably causing you problems. More than likely, you are setting something in your Windows PowerShell console profile, and it is not available inside the Windows PowerShell ISE.

Unraveling the profiles

You can pipe the $profile variable to the Get-Member cmdlet and see additional properties that exist on the $profile variable. This technique is shown here.

PS C:\> $PROFILE | Get-Member -MemberType noteproperty | select name








If you are accessing the $profile variable from within the Windows PowerShell console, the AllUsersCurrentHost and the CurrentUserCurrentHost note properties refer to the Windows PowerShell console. If you access the $profile variable from within the Windows PowerShell ISE, the AllUsersCurrentHost and the CurrentUserCurrentHost note properties refer to the Windows PowerShell ISE profiles.

Using the $profile variable to refer to more than the current host

When you reference the $profile variable, by default it refers to the Current User, Current Host profile. If you pipe the variable to the Format-List cmdlet, it still refers to the Current User, Current Host profile. This technique is shown here.

PS C:\> $PROFILE | Format-List *


This leads to a bit of confusion, especially because the Get-Member cmdlet reveals the existence of multiple profiles and multiple note properties. The way to see all of the profiles for the current host, is to use the force parameter. It reveals the hidden properties. The command illustrating this technique is shown here.

$PROFILE | Format-List * -Force

The command and the associated output from the command are shown in the image that follows.

Image of command output

It is possible to directly access each of these specific properties just like you would access any other property—via dotted notation. This technique is shown here.


The path to each of the four profiles for the Windows PowerShell console are shown in the image that follows.

Image of command output

Determine if a specific profile exists

To determine if a specific profile exists, use the Test-Path cmdlet and the appropriate flavor of the $profile variable. For example, to determine if a Current User, Current Host profile exists you can use the $profile variable with no modifier, or you can use the CurrentUserCurrentHost note property. The following example illustrates both of these.

PS C:\> test-path $PROFILE


PS C:\> test-path $PROFILE.CurrentUserCurrentHost


PS C:\>

In the same manner, the other three profiles that apply to the current host (in this example, I am using the Windows PowerShell console) are determined to not exist. This is shown in the code that follows.

PS C:\> test-path $PROFILE.AllUsersAllHosts


PS C:\> test-path $PROFILE.AllUsersCurrentHost


PS C:\> test-path $PROFILE.CurrentUserAllHosts


PS C:\>

Creating a new profile

To create a new profile for current user all hosts, use the CurrentUserAllHosts property of the $profile automatic variable, and the New-Item cmdlet. This technique is shown here.

PS C:\> new-item $PROFILE.CurrentUserAllHosts -ItemType file -Force

    Directory: C:\Users\ed.IAMMRED\Documents\WindowsPowerShell


Mode                LastWriteTime     Length Name

----                -------------     ------ ----

-a---         5/17/2012   2:59 PM          0 profile.ps1

To open the profile for editing, use the ise alias as shown here.

ise $PROFILE.CurrentUserAllHosts

When you are finished editing the profile, save it, close the Windows PowerShell console, reopen the Windows PowerShell console, and test that your changes work properly.

BB, that is all there is to using the $profile variable to discover different Windows PowerShell profiles. Windows PowerShell Profile Week will continue tomorrow when I will talk about editing and testing a Windows PowerShell profile.

I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at scripter@microsoft.com, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.

Ed Wilson, Microsoft Scripting Guy 

Comments (15)

  1. Nice explanation. You could possibly also create a static link from one to the other, althoguh i know i have different things in my console profile than my ise profile.

  2. Hi Paul Lynch, are you saying the "Current User, All Hosts" is the same file as the "Current User, Current Host – console" listed in the table.

    $Home[My ]DocumentsWindowsPowerShellProfile.ps1

    Are they the same file or how does that work ?

  3. Ed Wilson says:

    @Jeffrey S. Patton yes, you are correct about possibly linking one to the other in the profiles. In the article for the 23rd, I talk about using a central file for your profile. One way to get around  problems of incompatable commands is to detect the host, and use an if statement. Of course, my preference is to actually use a module (or several modules) for a profile.

  4. Rachel M says:

    Thank you for the article.  Do you know of any way to add another location for your profile.ps1?  I have a couple of computers that I jump around on, and it'd be beneficial to store my profile in the cloud.  Any ideas on how to implement that?

  5. Rachel M says:

    Oh, wow!  I found exactly what I needed in your "Use a Central File to Simplify Your PowerShell Profile" blog.  Thanks so much!

  6. Paul Lynch says:

    There's a typo in the table that lists the six profiles.

    The Current User, All Hosts profile is actually found in $Home[My ]DocumentsWindowsPowerShellProfile.ps1

  7. Young Pae says:

    Hello Ed,

    Thanks for your postings – It's been very helpful to clarify a lot of things.

    Question: On PSWA (PowerShell Web Access), what is the best way to set the profile for every user?

    All I want is to do the following so that they can always go to powershell library by default:

    set-location C:SUPPORT




  8. erric says:

    what are the four steps for saving profile after editing

  9. alex says:

    When I enter $Profile I get the same path as you show above

    C:Users*My DocumentsWindowsPowerShellMicrosoft.PowerShell_profile.ps1

    When I go to try to find this path it does not exist. There is no WindowsPowerShell folder in My Documents. Then when I type in the command you mentioned to edit the profile

    ise $PROFILE.CurrentUserAllHosts

    The ISE cannot find the location and tells me the path does not exist. How can PowerShell be pulling a profile from a location that does not exist? I have no trouble running PowerShell other than this. I need to edit my profile badly so that I can set Aliases
    and scripts in there. Please help! (if you even still read this page)

  10. nico says:

    Hi Alex,
    The $profile variable has those paths defined out-of-the-box; it will execute profiles located in those locations,
    however that does not the profiles also exist there out-of-the-box; you will in fact have to create them first.

    What you could do to create and then modify that profile is:
    New-Item -ItemType File -Path $PROFILE.CurrentUserAllHosts -Force
    ISE $PROFILE.CurrentUserAllHosts

  11. Alistair W says:

    Our sysadmins have mapped our home drives (including documents) to a network drive Z:.

    I find profiles do not work in the home folders, only in folders with the same name on the C: drive.

    Powershell 3.0 on Win7.

  12. Martin Lebel says:

    As your table list the 6 different profile, the profiles located at $Home[My ]DocumentsProfile.ps1 for the "Current User, All Hosts" scope does not seems to be a valid one. It is not listed when using "$PROFILE | Format-List * -Force" and when I’m creating
    it under Windows 10 it does absolutely nothing. I think the 3 profiles for "Current user" should be :

    C:Users*DocumentsWindowsPowerShellprofile.ps1 (CurrentUserAllHosts)
    C:Users*DocumentsWindowsPowerShellMicrosoft.PowerShellISE_profile.ps1 (CurrentUserISE)
    C:Users*DocumentsWindowsPowerShellMicrosoft.PowerShell_profile.ps1 (CurrentUserConsole)

  13. Carol W says:

    Can I safely delete psprofile.exe? I don’t know what it is doing but every day I get a message to say it cannot complete and I can either cancel it debug it. Neither seems to do any good. Can I find it and delete completely?

  14. Dave P says:

    Very nice explanation. Thanks!

  15. cadayton says:

    I believe after loading Visual Studio Community 2015 on Windows 10 Pro my default PowerShell Profile locations changed to the OneDrive folder. I’ve subsequently moved my OneDrive folder to the mount C:\bin\Adrive.
    Anyway, took a while to figure out why my profile wasn’t loading. I finally just moved the my profile to the location that PowerShell was looking for it to get things back to normal.

    How does one control the default location of the profile? Thanks.


Skip to main content