PSProfile.ps1

# References:
# 1. Below are the list of predefined vars that can be used:
# - $PSScriptRoot [System defined] The folder path for current scipt file, NOT the caller script to call this function

$PowerShellProfileDir = Join-Path $([Environment]::GetFolderPath("MyDocuments")) "WindowsPowerShell" -Resolve
if ($PSScriptRoot -like "$PowerShellProfileDir\*") { Import-Module MyProfile } else { Import-Module $PSScriptRoot }

# Invoke PsProfile for all MyProfiles in current scope based on load order
Invoke-MyProfile -PSProfile