Posted On December 17, 2022

How to Set PowerShell Window and Prompt Title or Label

kimconnect 0 comments
blog.KimConnect.com >> Windows >> How to Set PowerShell Window and Prompt Title or Label

Have you ever wondered about changing the boring PS C:\Windows\system32> whenever a new window is opened in PowerShell? You’re in luck by finding this quick note. Here’s how you’d do it:

# Set Window title to match current machine name
$host.UI.RawUI.WindowTitle="PS $env:computername $env:username"

# Set Window prompt to match current machine name
function prompt {"PS $env:computername $env:username> "}

# Set color of label
function prompt{
Write-Host ("PS $env:computername $env:username> ") -nonewline -foregroundcolor Yellow
return " "
}

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

ADFS Configurations

View existing ADFS global configs PS C:\Users\administrator.CAP> get-AdfsGlobalWebContentSignOutPageDescriptionText :UpdatePasswordPageDescriptionText :Locale :CompanyName :CertificatePageDescriptionText :ErrorPageDescriptionText :ErrorPageGenericErrorMessage :ErrorPageAuthorizationErrorMessage…

Memo of an Advisory Regarding WinRM on a Non-Domain Joined Server

# Enable WinRM winrm quickconfig <# Sample output PS C:\Users\Administrator> winrm quickconfig WinRM service is…

PowerShell: How To Configure Static IP Address

$nicName='NIC1' $ipaddress='192.168.0.222' $cidrPrefix=24 $defaultGateway='192.168.0.1' $dnsServers=@('8.8.8.8','4.4.2.2') $disableIpv6=$true function setNic($nicName,$ipAddress,$cidrPrefix,$defaultGateway,$dnsServers,$disableIpv6=$true ){ $ifIndex=(get-netadapter|?{$_.Name -eq $nicName}).ifIndex New-NetIPAddress -InterfaceIndex $ifIndex…