Created
August 1, 2016 15:07
-
-
Save pcgeek86/4a1b74f37eaecac58cf777820f0177c9 to your computer and use it in GitHub Desktop.
Trevor's PowerShell Prompt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Prompt { | |
| <# | |
| .Notes | |
| Author: Trevor Sullivan | |
| Website: https://trevorsullivan.net | |
| Twitter: https://twitter.com/pcgeek86 | |
| #> | |
| $ATAT = @' | |
| ____==========_______ | |
| _--____ | | "" " "| \ | |
| / )8} ^^^| 0 | = | o 0 | | |
| </_ +-==B vvv|"" | = | ' "" "| | |
| \_____/ |____|________|________| | |
| (_( )\________/___( )__) | |
| |\ \ / /\ | |
| | \ \ / /\ \ | |
| | |\ \ / / \ \ | |
| ( )( ) ( \ ( ) | |
| \ / / \ \ \ \ | |
| \| |\ \ \ | | | |
| | | )____ \ \ \ )___ | |
| ( ) / / ( ) (/ / | |
| /___\ /__/ /___\ /__/ | |
| You've discovered an AT-AT roaming Hoth! | |
| '@ | |
| if ((Get-Random -Maximum 20) -in @(9)) { | |
| Write-Host -ForegroundColor Cyan -Object $ATAT; | |
| } | |
| $Date = Get-Date | |
| $CPU = Get-CimInstance -ClassName Win32_PerfFormattedData_Counters_ProcessorInformation | |
| $CPUTime = $CPU.PercentProcessorTime | |
| ### NOTE: Using Get-Counter is 4x slower than using WMI performance counter classes | |
| #$CPUTime = Get-Counter -Counter '\Processor(*)\% Processor Time' | |
| #$CPUTime = $CPUTime.CounterSamples[-1].CookedValue | |
| ### Line 1 | |
| Write-Host -ForegroundColor Red -Object $env:USERNAME.ToLower() -NoNewline | |
| Write-Host -ForegroundColor White -Object '@' -NoNewline | |
| Write-Host -ForegroundColor Green -Object ($env:COMPUTERNAME.ToLower() + ' ') -NoNewline | |
| Write-Host -ForegroundColor White -Object (Get-Location) | |
| ### Line 2: Performance Data | |
| Write-Host -ForegroundColor Cyan -Object ('CPU: {0}' -f $CPUTime) | |
| ### Line 3 | |
| '$ ' | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment