PowerShell 2.0 – Accessing Different Profiles

Just ran across a new feature of PowerShell 2.0 that is convenient.  Need the path to the various profile scripts on a system?  Try this:

PS> $profile.psextended | Format-List

AllUsersAllHosts       : C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1
AllUsersCurrentHost    : C:\Windows\System32\WindowsPowerShell\v1.0\Microsoft.PowerShell_profile.ps1
CurrentUserAllHosts    : C:\Users\Keith\Documents\WindowsPowerShell\profile.ps1
CurrentUserCurrentHost : C:\Users\Keith\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

To access individually you can use $profile.AllUsersAllHosts.

psmdtag:variable Profile

This entry was posted in PowerShell 2.0. Bookmark the permalink.

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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s