Updated my-profile.ps1 and update-powershell-profile.ps1

This commit is contained in:
Markus Fleschutz 2024-05-22 07:20:21 +02:00
parent cbf0c4ce14
commit b6fe047973
2 changed files with 9 additions and 9 deletions

View File

@ -1,11 +1,11 @@
# MY POWERSHELL PROFILE (defines the look & feel of PowerShell)
# WINDOW TITLE
if ($IsLinux) { $Username = $(whoami) } else { $Username = $env:USERNAME }
$host.ui.RawUI.WindowTitle = "$Username @ $(hostname)"
if ($IsLinux) { $username = $(whoami) } else { $username = $env:USERNAME }
$host.ui.RawUI.WindowTitle = "$username @ $(hostname)"
# GREETING
Write-Host "Welcome $USERNAME at $(hostname), what's up?" -foregroundColor green
Write-Host "👋 Welcome $username to PowerShell at $(hostname)." -foregroundColor green
# COMMAND PROMPT
function prompt { Write-Host "`n" -noNewline -foregroundColor yellow; return " " }

View File

@ -1,15 +1,15 @@
<#
.SYNOPSIS
Updates the PowerShell profile
Updates the user's PowerShell profile
.DESCRIPTION
This PowerShell script write/overwrites the PowerShell profile for the current user.
This PowerShell script write/overwrites the PowerShell profile of the current user.
.PARAMETER path
Specifies the path to the new profile ($PSScriptRoot/my-profile.ps1 by default)
.EXAMPLE
PS> ./update-powershell-profile.ps1
(1/2) Query location of PowerShell profile 'CurrentUserCurrentHost'...
(1/2) Query path to PowerShell profile 'CurrentUserCurrentHost'...
(2/2) Copy my-profile.ps1 to C:\Users\Markus\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1...
Your PowerShell profile is updated - it get's active on next login.
Updated your PowerShell profile - it get's active on next login.
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -19,7 +19,7 @@
param([string]$path = "$PSScriptRoot/my-profile.ps1")
try {
"⏳ (1/2) Query location of PowerShell profile 'CurrentUserCurrentHost'..."
"⏳ (1/2) Query path to PowerShell profile 'CurrentUserCurrentHost'..."
$pathToProfile = $PROFILE.CurrentUserCurrentHost
$filename = (Get-Item "$path").Name
@ -27,7 +27,7 @@ try {
$null = New-Item -Path $pathToProfile -ItemType "file" -Force
Copy-Item "$path" "$pathToProfile" -force
"✔️ Your PowerShell profile is updated - it get's active on next login."
"✔️ Updated your PowerShell profile - it get's active on next login."
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"