Install the latest version of PowerShell
- Get the newest version from the Github page (msi version for windows):
https://github.com/PowerShell/PowerShell/releases
- Move the MSI to the server. This can be done by going to the C$ of the server after the firewall is off.
- Run and install the MSI:
msiexec.exe /package PowerShell-7.0.2-win-x64.msi /quiet ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1 ENABLE_PSREMOTING=1 REGISTER_MANIFEST=1
# Go ahead and install the windows update module while at it. Install-Module PSWindowsUpdate
Install SSH
Configure Prompt
- Configure the default prompt for all users by editing the file $PSHOME\Profile.ps1
Here's the contents of the current prompt version
function prompt { $pidentity = [Security.Principal.WindowsIdentity]::GetCurrent() $pprincipal = [Security.Principal.WindowsPrincipal] $pidentity $padminRole = [Security.Principal.WindowsBuiltInRole]::Administrator # set username color based on permissions if (Test-Path variable:/PSDebugContext) { $pcolor = "yellow" } elseif($pprincipal.IsInRole($padminRole)) { $pcolor = "red" } else { $pcolor = "green" } $PromptTime = $(get-date).ToString("hh:mm MM/dd/yy") # Display titlebar $host.ui.rawui.WindowTitle = "::" + $env:computername + ":: - " + $PromptTime + " - PS Version: " + $Host.Version + " Line: " + $host.UI.RawUI.CursorPosition.Y $ppath = ((get-location).path).replace($Home,'~')
if ( $ppath.length -gt 20 ) {
$ppath = ".." + $ppath.substring($ppath.length - 20)
}
# Write Prompt Write-Host "[" -NoNewline Write-Host "$env:UserName" -f $pcolor -NoNewline Write-Host "@" -NoNewline Write-Host "$env:computername" -f DarkCyan -NoNewline Write-Host " $ppath]:" -NoNewline return " " }
|
|