The project contains the source code of my PowerShell profile as well as the
PowerTools module. You need at least version 7.4 or higher to use this project.
Note that you need administrator rights in order to create symbolic links on
Windows, unless you have turned on Developer Mode in the settings app:
Instructions
# Save the PowerShell profile in the current working directory
Invoke-WebRequest -Uri https://raw.githubusercontent.com/StefanGreve/profile/refs/heads/master/profile.ps1 -Out profile.ps1
# Add some additional features to the profile on startup (optional)
Install-Module -Name PowerTools -Force# Select a profile path (Recommended: CurrentUserAllHosts)
$PROFILE | Get-Member -Type NoteProperty | Format-List
$Definition = $PROFILE
| Get-Member -Type NoteProperty
| Where-Object Name -eq CurrentUserAllHosts
| Select-Object -ExpandProperty Definition
$ProfilePath = $Definition.Split("=")[1]
# Create a PowerShell directory if necessary
New-Item $(Split-Path -Parent $ProfilePath) -ItemType Directory -ErrorAction SilentlyContinue
# Create a new symbolic link
New-Item -Path $ProfilePath -ItemType SymbolicLink -Value $(Resolve-Path profile.ps1).Path# Create a new symbolic link
New-Item -Path $PROFILE -ItemType SymbolicLink -Value $(Resolve-Path ./profile.ps1).Value -ForceThis profile is also part of the
configuration
repository.
Some additional features can be turned on by setting their respective environment variables:
PROFILE_LOAD_CUSTOM_SCRIPTS: Declare a single path to dot-source Powershell scripts from on profile launch.PROFILE_ENABLE_BRANCH_USERNAME: Set this value to1to display the active Git user name next to the branch name in the console prompt (off by default)
Setup the development environment:
dotnet tool restore
dotnet husky installSet your ExecutionPolicy to Unrestricted in order to run any of these
scripts. Note that this configuration step only applies to Windows users.
on non-Windows computers, Unrestricted is already the default ExecutionPolicy
and cannot be changed (see also:
About Execution Policy)
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy UnrestrictedUse the build.ps1 script for creating a new version of the PowerTools module.
Remember to unload the module if you have installed it from the PowerShell Gallery.
Remove-Module PowerTools
# Local builds should use this version number
./scripts/build.ps1 -Version 0.0.0During development, the Version number of this module is configured as 0.0.0.
See also
Types.ps1xml and Format.ps1xml files
for editing ps1xml files.