---
title: PowerShell Profile : A Getting Started Guide
description: Discover everything you need to know about the PowerShell Profile in this definitive guide with real-world examples!
canonical: https://adamtheautomator.com/powershell-profile-a-getting-started-guide/
---

# PowerShell Profile : A Getting Started Guide

> Discover everything you need to know about the PowerShell Profile in this definitive guide with real-world examples!

Source: https://adamtheautomator.com/powershell-profile-a-getting-started-guide/

---

- PowerShell Profile : A Getting Started Guide Tap to hide Home

- Tutorials

- Guidebooks

- Instructors

- Get Paid to Write

- Advertising

- Recommended Resources

- About Adam

                Search for:

-

-

-

-

# PowerShell Profile : A Getting Started Guide

        Published:23 November 2022 - 5 min. read

- PowerShell

          [](https://adamtheautomator.com/author/uzma-younas/)

            [Uzma Younas](https://adamtheautomator.com/author/uzma-younas/)

            Read [more tutorials](https://adamtheautomator.com/author/uzma-younas/) by Uzma Younas!

-

        [](https://specopssoft.com/product/specops-password-auditor/?utm_source=adamtheautomator&utm_medium=referral&utm_campaign=adamtheautomator_referral_na&utm_content=display)
        Audit Active Directory for stale users, weak passwords, and other security risks with [Specops Password Auditor](https://specopssoft.com/product/specops-password-auditor/?utm_source=adamtheautomator&utm_medium=referral&utm_campaign=adamtheautomator_referral_na&utm_content=text).

Table of Contents

- Prerequisites
- Creating a PowerShell Profile
- Customizing a PowerShell ProfileSetting Aliases for Quick Commands and Functions Accessibility
- Customizing How the PowerShell Console Looks
- Supplying Default Values for Parameters
- Conclusion

                XFacebookLinkedIn

Have you ever felt tired of running the exact commands or scripts repeatedly? Why not let a PowerShell profile make your life easier?

A PowerShell Profile is a script composed of written instructions that execute when you launch a PowerShell session. And in this tutorial, you will learn many ways to configure your PowerShell profile.

Sounds interesting? Stay tuned and automate custom code executions!

## Prerequisites

- A Windows or Linux computer – This tutorial uses Windows 11 PC.

- PowerShell 7 or 5.1 installed on your system.

Related:[PowerShell 7 Upgrade : A How to Walk Through](https://adamtheautomator.com/powershell-7-upgrade/)

## Creating a PowerShell Profile

A PowerShell profile is a regular script that runs each time you start a PowerShell session. Depending upon the operating system, the PowerShell profile for ‘current user, current host’ is located at the following:

Operating SystemPowerShell Profile LocationWindows$Home\Documents\PowerShell\Microsoft.PowerShell_profile.ps1macOS and Linux~/.config/powershell/Microsoft.Powershell_profile.ps1

To create a PowerShell profile:

1. Open [PowerShell as administrator](https://adamtheautomator.com/powershell-run-as-administrator/), and run the below Test-Path command to check if a PowerShell profile already exists.

 Test-Path $profile

Related:[How to Use the PowerShell Test-Path Cmdlet](https://adamtheautomator.com/powershell-test-path/)

Below, you can see the command returned False, which confirms there is no existing PowerShell profile yet.

Checking for an existing PowerShell profile

There are, in fact, different profiles for the current user and all users, as shown below. But when talking about the Windows PowerShell profile, you are referring to the ‘Current user – Current Host’ profile.

Windows PowerShell 5.1

ProfilePathCurrent User – Current Host$Home\[My ]Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1Current User – All Hosts$Home\[My ]Documents\WindowsPowerShell\Profile.ps1All Users – Current Host$PSHOME\Microsoft.PowerShell_profile.ps1All Users – All Hosts$PSHOME\Profile.ps1

💡 The $Home variable references the current users home directory while the $PSHOME variable references the installation path of PowerShell.

PowerShell 7.x

ProfilePathCurrent User – Current Host – Windows$Home\[My ]Documents\Powershell\Microsoft.Powershell_profile.ps1Current User – Current Host – Linux/macOS~/.config/powershell/Microsoft.Powershell_profile.ps1Current User – All Hosts – Windows$Home\[My ]Documents\Powershell\Profile.ps1Current User – All Hosts – Linux/macOS~/.config/powershell/profile.ps1All Users – Current Host – Windows$PSHOME\Microsoft.Powershell_profile.ps1All Users – Current Host – Linux/macOS/usr/local/microsoft/powershell/7/Microsoft.Powershell_profile.ps1All Users – All Hosts – Windows$PSHOME\Profile.ps1All Users – All Hosts – Linux/macOS/usr/local/microsoft/powershell/7/profile.ps1

2. Next, run the following [New-Item](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/new-item?view=powershell-7.2) command to create your PowerShell profile. This command creates a script file in the Current User – Current Host profile path ($profile).

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

Creating a new PowerShell profile

Now, run each of the below commands to check the path of the PowerShell profile for each user.

# Return the PowerShell profile path of the Current user - Current host
$profile
# Return the PowerShell profile path of the Current user - All hosts
$profile.CurrentUserAllHosts
# Return the PowerShell profile path of the All users - Current host
$profile.AllUsersCurrentHost
# Return the PowerShell profile path of the All users - Current host
$profile.AllUsersAllHosts

The outputs below display the path of each profile for PowerShell 5 and 7.

Checking PowerShell 5 profiles location

Checking PowerShell 7 profiles location

## Customizing a PowerShell Profile

A newly-created PowerShell profile is blank by default. You can include variables, aliases, and commands you frequently use in your PowerShell profile without recreating them in each session.

But first, you may want to change PowerShell’s execution policy since PowerShell disables the execution of scripts by default to prevent malicious scripts from affecting the system.

Run the command below to set PowerShell’s execution policy ([Set-ExecutionPolicy](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.security/set-executionpolicy?view=powershell-7.2)) to RemoteSigned.

The RemoteSigned policy dictates that any script should be signed if not created on the system where you run them. This policy requires a digital signature for the scripts to come from the internet or be downloaded by applications such as Internet Explorer, Outlook, or Messenger.

Set-ExecutionPolicy RemoteSigned

Setting execution policy to RemoteSigned

Related:[Set-ExecutionPolicy for Managing PowerShell Execution Policies](https://adamtheautomator.com/set-executionpolicy/)

Now, run either of the following commands, which do not provide output, but open your PowerShell profile ($PROFILE) in PowerShell ISE or Notepad.

# Opens PowerShell profile in PowerShell ISE
ise $PROFILE
# Opens PowerShell profile in Notepad
notepad $PROFILE

### Setting Aliases for Quick Commands and Functions Accessibility

Aliases are the most common customizations, as they let you refer to PowerShell commands by your chosen name.

Add the following aliases to your PowerShell profile, save the changes but do not close the file yet.

# Create aliases for frequently used applications.
New-Alias np Notepad.exe

# Create aliases for frequently used commands
Set-Alias tn Test-NetConnection

### Customizing How the PowerShell Console Looks

Apart from aliases, you can also change how PowerShell operates and enhance its interactive experience with a personalized prompt.

1. Include the following content in your PowerShell profile to reflect the changes in default settings, save the changes and close the file.

The Color-Console function below changes the default appearance of PowerShell by changing its color and displaying the current date/time.

# Create a function to change colors in PowerShell
function Color-Console {
	$Host.ui.rawui.backgroundcolor = "darkcyan"
	$Host.ui.rawui.foregroundcolor = "white"
	$hosttime = (Get-ChildItem -Path  $PSHOME\\PowerShell.exe).CreationTime
	$Host.UI.RawUI.WindowTitle  =  "PowerShell ($hosttime)"
	Clear-Host
}

# Calls the Color-Console function
Color-Console

2. Now, run the below command to reload your PowerShell profile.

 . $profile

You will see the following changes to your profile reflected on the PowerShell console.

Reloading the PowerShell profile

3. Lastly, run the tn alias you set in your PowerShell profile instead of the Test-NetConnection cmdlet to test your network connection. Likewise, you can use np to open the notepad.

# Test network connection
tn
# Open notepad
np

Testing network connection by running an alias of Test-NetConnection cmdlet

### Supplying Default Values for Parameters

Instead of repeatedly specifying a hard-to-remember particular parameter value, why not use the $PSDefaultParameterValues preference variable? This feature is handy as it lets you specify custom values for a cmdlet or function.

The $PSDefaultParameterValues preference variable is a hash table with entries in two parts: the key and the value. Keys must match the pattern cmdlet:parameter, where values can be either a parameter (a string, boolean, or integer) or a script block.

The general syntax for using the $PSDefaultParameterValues preference variable is as follows:

$PSDefaultParameterValues=@{"CmdletName:ParameterName"="DefaultValue"}

To see the $PSDefaultParameterValues preference variable in action:

1. Run the below command, which does not provide output, but sets the Verbose parameter True for all commands (*). A new entry will be added to the $PSDefaultParameterValues hash table.

$PSDefaultParameterValues=@{"*:Verbose"=$True}

2. Next, run the $PSDefaultParameterValues variable without parameters to verify the default parameter variable value.

$PSDefaultParameterValues

Changing default values for parameters

Now, run the following tn alias to test your network connection.

tn

Below, you can see the verbose details as the command runs since the Verbose parameter value is set to True by default for all commands.

Testing the $PSDefaultParameterValues preference variable

## Conclusion

In this tutorial, you came across several features of the PowerShell profile and changed the looks of your PowerShell console. But more importantly, you learned how PowerShell lets you define and reuse frequently used scripts.

With this newfound knowledge, if you are mainly a PowerShell user, why not add new aliases and scripts to run on startups to assist with your workflow? Having a PowerShell profile configured indeed is a lifesaver!

  Hate ads? Want to support the writer? Get many of our tutorials packaged as an ATA Guidebook.

  [Explore ATA Guidebooks](https://adamtheautomator.com/ata-guidebooks/)

## More from ATA Learning and Partners

- ### Recommended Resources! Recommended Resources for Training, Information Security, Automation, and more!

- ### Get Paid to Write! ATA Learning is always seeking instructors of all experience levels. Regardless if you’re a junior admin or system architect, you have something to share. Why not write on a platform with an existing audience and share your knowledge with the world?

- ### ATA Learning Guidebooks ATA Learning is known for its high-quality written tutorials in the form of blog posts. Support ATA Learning with ATA Guidebook PDF eBooks available offline and with no ads!

## Categories

- IT Ops

- Cloud

- DevOps

- Home Ops

- Information Security

- Software Development

## Site

- Home

- Tutorials

- Guidebooks

- Instructors

- Get Paid to Write

- Advertising

- Recommended Resources

- About Adam

        Copyright 2026&copy; ATA Learning | [Privacy Policy](https://adamtheautomator.com/privacy/)

                                                        Don't be left behind with the ATA Learning Newsletter!

Looks like you're offline!
