Q. What is common content to place in the PowerShell profile?
A. There is no fixed content required in a PowerShell profile. The content should be based on your requirements. Some common settings are to set environmental configurations, load modules, create aliases and modify the prompt. Below is some example content:
Set-Location c:\
#Set window colors and title
$shell = $Host.UI.RawUI
$shell.WindowTitle="John's PowerShell"
$shell.BackgroundColor = "Black"
$shell.ForegroundColor = "White"
#Set the window size
$size = $Shell.WindowSize
$size.width=70
$size.height=25
$Shell.WindowSize = $size
#Set the buffer sizes
$size = $Shell.BufferSize
$size.width=70
$size.height=5000
$Shell.BufferSize = $size
#Load modules
#Import-Module ....
#Create a notepad alias
New-Item alias:np -value c:\windows\system32\notepad.exe
#Clear the screen
Clear-Host
Each week, John Savill answers all of your toughest tech questions about the worlds of Windows Server, Azure, and beyond. Read his past IT advice here, and email your questions to john@savilltech.com.
0 comments
Hide comments