update-powershell-profile
Updates the user's PowerShell profile
#Requires -Version 5.1
param([string]$path = "$PSScriptRoot/my-profile.ps1")
try {
"⏳ (1/2) Querying path to PowerShell profile 'CurrentUserCurrentHost'..."
$pathToProfile = $PROFILE.CurrentUserCurrentHost
$filename = (Get-Item "$path").Name
"⏳ (2/2) Copying $filename to $pathToProfile..."
$null = New-Item -Path $pathToProfile -ItemType "file" -Force
Copy-Item "$path" "$pathToProfile" -force
"✅ PowerShell profile updated - it get's active on next login."
exit 0
} catch {
throw
}Specifies the path to the new profile ($PSScriptRoot/my-profile.ps1 by default)