Skip to content

Instantly share code, notes, and snippets.

@pcrockett-pathway
Created January 9, 2019 12:31
Show Gist options
  • Select an option

  • Save pcrockett-pathway/8ce649e7ed8661ba2e1be923e0c68e82 to your computer and use it in GitHub Desktop.

Select an option

Save pcrockett-pathway/8ce649e7ed8661ba2e1be923e0c68e82 to your computer and use it in GitHub Desktop.
Admin PowerShell Profile
$ErrorActionPreference = "Stop"
<#
.SYNOPSIS
Will reset your colors to the scheme found in $PROFILE
.DESCRIPTION
Useful for when programs mess up your favorite console colors. WARNING:
Will clear your screen.
.EXAMPLE
Initialize-Colors
#>
function Initialize-Colors {
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 5.0
[Console]::BackgroundColor = "Black"
[Console]::ForegroundColor = "White"
$Host.PrivateData.VerboseForegroundColor = "DarkGray"
Clear-Host
}
Initialize-Colors
$Lambda = "[$env:USERNAME]"
function Prompt {
if (Test-Path Variable:\PSDebugContext) {
$debugPrefix = ' [DBG] '
}
else {
$debugPrefix = ' '
}
Write-Host -ForegroundColor Green "$PWD "
Write-Host -NoNewline -ForegroundColor Cyan $Lambda
$debugPrefix
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment