Create PowerShell Profile

$Profile: This is built-in variable. Which displays the profile location. But path and profile do not exists until we create profiles.

Create PowerShell Profile

Test-Path $Profile: Will give information about profile established or not.

Create PowerShell Profile

If Test-Path $Profile gives false as above. Then, need to create profile with following syntax.

New-Item -Path $Profile -type file -force


Now run Test-Path $Profile to check has configured or not.


How to customize PowerShell Profile:

1. Go to Profile path(In my case is C:\Users\Administrator\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1)

2. Double click Microsoft.PowerShell_profile.ps1

3. Enter following lines in profile.
Write-Host “Welcome to K2schools PowerShell Tutorials”
Write-Host “”
Write-Host “”

4. Save the file.

5. Close all opened PowerShell consoles and open new PowerShell. Then, we will notice the changes.


Powered by k2schools