An enterprise-ready PowerShell Core profile customization framework. This suite transforms PowerShell Core into a high-performance, developer-friendly shell with professional themes, terminal iconography, and Unix-equivalent utilities. It features an asynchronous startup sequence to guarantee sub-second interactive load times.
Here is an image, how the finished config looks like, but this can be easily changed, via OhMyPosh. However, this preview is not so meaningful, as most of the visual configuration is done by OhMyPosh:
PowerShell profiles often suffer from slow startup times due to heavy imports and check sequences. This project solves that via Asynchronous / Deferred Initialization.
sequenceDiagram
autonumber
actor User as User
participant Host as PWSH Host
participant Profile as Microsoft.PowerShell_profile.ps1
participant Runspace as Background Runspace
participant Config as pwsh_custom_config.yml
User->>Host: Open Terminal
Host->>Profile: Execute Profile Script
Profile->>Config: Check cached dependency state
Note over Profile,Config: Fast path (cached True): Skip Winget/NuGet checks
Profile->>Host: Immediately load Oh My Posh & Terminal Icons
Host->>User: Render Interactive Prompt (<0.8s)
rect rgb(240, 240, 240)
Note right of Profile: Asynchronous Deferred Load
Profile->>Runspace: Spawn Background Runspace
Runspace->>Runspace: Dot-source functions.ps1 (Unix utilities)
Runspace->>Runspace: Run BackgroundTasks (Update checks)
end
- Checks the local cache configuration (
pwsh_custom_config.yml). - If dependencies are missing, redirects execution to
installer.ps1in the foreground. - Imports
Terminal-Iconsand initializesoh-my-poshwith the configured theme. - Renders the prompt immediately for the user.
- Spawns a background PowerShell runspace (
[runspacefactory]) to avoid blocking the user input thread. - Loads custom Unix-like aliases and helper scripts (
functions.ps1). - Executes background checks (
powershell_helper.ps1) to verify engine updates (via winget) and download updated scripts from GitHub asynchronously.
This repository contains the following core files:
.
βββ LICENSE # Project license (GNU GPL v3)
βββ Microsoft.PowerShell_profile.ps1 # Primary profile entry point and configuration header
βββ README.md # Documentation and reference manual
βββ assets/
β βββ preview.png # Showcase image of the customized prompt
βββ functions.ps1 # Main script file defining Unix-like utilities and aliases
βββ installer.ps1 # Automated bootstrap and dependency installer
βββ powershell_helper.ps1 # Background worker script managing engine updates and cache syncing
- Blazing Fast Startup: Asynchronous runspace loading ensures a responsive prompt in less than a second.
- Oh My Posh Prompt Integration: Customizable prompts with Git branch indicators, exit codes, and resource metrics.
- Terminal Icons: Enhances files and folders listings with visual glyphs (Nerd Fonts).
- Silent Background Updates: Automatically checks for new PowerShell Core releases and upgrades them via Windows Package Manager (
winget). - Offline Reliability: Caches functions and settings locally for full offline access.
- Elevated Execution: Optional
gsudoconfiguration for inline elevation matching Unixsudo.
To configure your profile automatically, open a PowerShell console and execute the following bootstrap script:
iex (iwr "https://raw.githubusercontent.com/Maheswara660/Powershell/main/Microsoft.PowerShell_profile.ps1").Content- Clone this repository to your computer:
git clone https://github.com/Maheswara660/Powershell.git
- Place the repository folder in your home directory or custom location.
- Edit your PowerShell profile file (check path by running
$PROFILEin your terminal) and append the following block:# BEGIN Powershell v1.0.0 if (Test-Path (Join-Path -Path $env:USERPROFILE -ChildPath "Powershell\Microsoft.PowerShell_profile.ps1")) { . (Join-Path -Path $env:USERPROFILE -ChildPath "Powershell\Microsoft.PowerShell_profile.ps1") } else { iex (iwr "https://raw.githubusercontent.com/Maheswara660/Powershell/main/Microsoft.PowerShell_profile.ps1").Content } # END Powershell v1.0.0
- Restart your terminal. The profile will automatically download and install required dependencies (FiraCode Nerd Font, Oh My Posh, modules) on the first run.
Custom parameters are stored in ~/Powershell/pwsh_custom_config.yml. This YAML file caches the installation status of key components to expedite subsequent startup runs:
| Configuration Key | Type | Description |
|---|---|---|
Terminal-Icons_installed |
Boolean (True/False) |
Status of the Terminal-Icons module. |
Powershell-Yaml_installed |
Boolean (True/False) |
Status of the Powershell-Yaml module. |
PoshFunctions_installed |
Boolean (True/False) |
Status of the PoshFunctions utility module. |
FiraCode_installed |
Boolean (True/False) |
Status of the FiraCode Nerd Font installer. |
ohmyposh_installed |
Boolean (True/False) |
Status of the Oh My Posh prompt engine. |
vscode_installed |
Boolean (True/False) |
Indicates if VS Code integration is configured. |
This profile imports custom aliases and helper functions that provide a familiar Unix command line environment on Windows:
| Unix Command | PowerShell Equivalent / Custom Implementation | Description |
|---|---|---|
cd |
Set-Location |
Changes the current working directory. |
ls |
Get-ChildItem |
Lists directory contents. |
ll |
Custom Get-ChildItem wrapper |
Lists files only (excluding directories) in the current directory. |
dirs |
Custom dirs function |
Performs a recursive file search (dir /s /b equivalent). |
grep |
Select-String wrapper |
Searches for patterns inside text files recursively or via pipeline. |
sed |
Custom replace helper | Performs simple stream-editing to replace target text within a file. |
touch |
Custom touch function |
Creates an empty file or updates the access/modification timestamps of an existing file. |
unzip |
Expand-Archive wrapper |
Extracts zip archives directly in the working directory. |
du |
Custom directory measure | Displays human-readable file sizes and counts recursively. |
df |
Get-Volume wrapper |
Displays disk space usage statistics. |
top |
Interactive CPU/Handle Monitor | Launches an interactive process explorer that updates dynamically. |
uptime |
Custom uptime calculator | Calculates and displays system online duration. |
which |
Get-Command lookup |
Resolves the absolute executable/command path. |
export |
env: provider |
Sets environment variables. |
pgrep |
Get-Process |
Searches for running processes by name. |
pkill |
Stop-Process |
Stops or terminates running processes by name. |
head |
Get-Content -Head wrapper |
Displays the first N lines of a file (default: 10). |
tail |
Get-Content -Tail wrapper |
Displays the last N lines of a file (default: 10). |
md5 |
Get-FileHash -Algorithm MD5 |
Calculates MD5 checksum for files. |
sha1 |
Get-FileHash -Algorithm SHA1 |
Calculates SHA-1 checksum for files. |
sha256 |
Get-FileHash -Algorithm SHA256 |
Calculates SHA-256 checksum for files. |
ssh-copy-key |
Custom SSH script | Copies the default public key (id_ed25519.pub) to a remote host. |
reboot |
Restart-Computer -Force |
Reboots the system immediately. |
poweroff |
Stop-Computer -Force |
Shuts down the system immediately. |
cd... |
Set-Location ..\.. |
Moves up two directory levels. |
cd.... |
Set-Location ..\..\.. |
Moves up three directory levels. |
c: Sort processes by CPU usage.h: Sort processes by Handles count.n: Sort processes by Non-Paged Memory (NPM).p: Sort processes by Paged Memory (PM).w: Sort processes by Working Set (WS).q: Quit the interactive monitor.
To customize this project for your own GitHub repository, modify the header variables in Microsoft.PowerShell_profile.ps1:
$githubUser = "Maheswara660" # Update to your GitHub username
$githubRepo = "Powershell" # Update to your repository name
$name = "YourName" # Welcoming message nameThe default profile configures the montys.omp.json theme. You can swap this out by updating $OhMyPoshConfigFileName to any of the official Oh My Posh themes, or customize it locally in the installation directory.
Contributions, bug reports, and enhancements are welcome! Please open an issue or submit a pull request on the repository.
This project is licensed under the GNU General Public License v3.
Developed by Maheswara660 with β€οΈ
