Created
August 20, 2016 14:12
-
-
Save Sidneys1/eaacc00cc69afd516fad85138af2fbda to your computer and use it in GitHub Desktop.
'screenfetch'-like logo for powershell
This file contains 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 Get-Uptime() { | |
$lastboottime = (Get-WmiObject -Class Win32_OperatingSystem).LastBootUpTime | |
$sysuptime = (Get-Date) - [System.Management.ManagementDateTimeconverter]::ToDateTime($lastboottime) | |
if ($sysuptime.days -eq 1) { Write-Host -NoNewline $sysuptime.days "day " } | |
if ($sysuptime.days -gt 1) { Write-Host -NoNewline $sysuptime.days "days " } | |
if ($sysuptime.hours -eq 1) { Write-Host -NoNewline $sysuptime.hours "hour " } | |
if ($sysuptime.hours -gt 1) { Write-Host -NoNewline $sysuptime.hours "hours " } | |
if ($sysuptime.minutes -eq 1) { Write-Host -NoNewline $sysuptime.minutes "minute " } | |
if ($sysuptime.minutes -gt 1) { Write-Host -NoNewline $sysuptime.minutes "minutes " } | |
if ($sysuptime.seconds -eq 1) { Write-Host -NoNewline $sysuptime.seconds "second " } | |
if ($sysuptime.seconds -gt 1) { Write-Host -NoNewline $sysuptime.seconds "seconds " } | |
Write-Host | |
} | |
$userstring = { Write-Host -NoNewline -ForegroundColor Red " User: "; Write-Host -NoNewline -ForegroundColor Yellow "$([Environment]::Username)";write-host -NoNewline "@";Write-Host -ForegroundColor Yellow "$([Environment]::MachineName)" } | |
$windowsstring = { Write-Host -NoNewline -ForegroundColor Red " Windows: "; Write-Host "$($psversiontable.buildversion.tostring())"} | |
$dotnetstring = { Write-Host -NoNewline -ForegroundColor Red " .NET: "; Write-Host "$($psversiontable.clrversion.tostring())"} | |
$powershellstring = { Write-Host -NoNewline -ForegroundColor Red "Powershell: "; Write-Host "$psedition-$($psversiontable.psversion.tostring()) $psculture" } | |
$processes = { Write-Host -NoNewline -ForegroundColor Red "Processses: "; Write-Host (ps).count } | |
$modules = { Write-Host -NoNewline -ForegroundColor Red "PS Modules: "; Write-Host "$((Get-Module).count)" } | |
$uptime = { Write-Host -NoNewline -ForegroundColor Red " Uptime: "; Get-Uptime } | |
$proc = { Write-Host -NoNewline -ForegroundColor Red " CPU: "; $proc = gwmi Win32_processor; Write-Host "$($proc.name) x$($proc.numberoflogicalprocessors) ($(($proc | measure LoadPercentage -Average).average)%)"} | |
$mem = { Write-Host -NoNewline -ForegroundColor Red " Memory: "; $os = gwmi win32_operatingsystem; [long]$tmem=[long]$os.totalvisiblememorysize/1024;[long]$fmem=[long]$os.freephysicalmemory/1024; Write-Host "$($tmem - $fmem)/$tmem MB ($((($tmem - $fmem) / $tmem).tostring("P0")))"} | |
$video = { Write-Host -NoNewline -ForegroundColor Red " Video: "; $v = gwmi win32_videocontroller; [long]$ram=[long]$v.adapterram/(1024*1024); Write-Host "$($v.name) ($ram MB VRAM) @ $($v.currenthorizontalresolution)x$($v.currentverticalresolution) $($v.currentrefreshrate)hz"} | |
function Write-Logo( | |
[scriptblock]$p1={Write-Host}, | |
[scriptblock]$p2={Write-Host}, | |
[scriptblock]$p3={Write-Host}, | |
[scriptblock]$p4={Write-Host}, | |
[scriptblock]$p5={Write-Host}, | |
[scriptblock]$p6={Write-Host}, | |
[scriptblock]$p7={Write-Host}, | |
[scriptblock]$p8={Write-Host}, | |
[scriptblock]$p9={Write-Host}, | |
[scriptblock]$p10={Write-Host}, | |
[scriptblock]$p11={Write-Host}, | |
[scriptblock]$p12={Write-Host}, | |
[scriptblock]$p13={Write-Host}, | |
[scriptblock]$p14={Write-Host}, | |
[scriptblock]$p15={Write-Host}, | |
[scriptblock]$p16={write-host}) { | |
Write-Host -ForegroundColor Red -NoNewline " .,:rsr,"; Write-Host -ForegroundColor Green -NoNewline " "; Invoke-Command -ScriptBlock $p1 | |
Write-Host -ForegroundColor Red -NoNewline " :2;m;r2A@@5"; Write-Host -ForegroundColor Green -NoNewline " "; Invoke-Command -ScriptBlock $p2 | |
Write-Host -ForegroundColor Red -NoNewline " @2::s5A#@@@ "; Write-Host -ForegroundColor Green -NoNewline "@r . "; Invoke-Command -ScriptBlock $p3 | |
Write-Host -ForegroundColor Red -NoNewline " sd::riXA#@@ "; Write-Host -ForegroundColor Green -NoNewline ":@@@Gir;;AS9 "; Invoke-Command -ScriptBlock $p4 | |
Write-Host -ForegroundColor Red -NoNewline " Bs::sS3A#@2 "; Write-Host -ForegroundColor Green -NoNewline "@@#AhXirsS#; "; Invoke-Command -ScriptBlock $p5 | |
Write-Host -ForegroundColor Red -NoNewline " iHr:r5d#@@@ "; Write-Host -ForegroundColor Green -NoNewline ".@#95sr;;rie "; Invoke-Command -ScriptBlock $p6 | |
Write-Host -ForegroundColor Red -NoNewline " ' ,@3 "; Write-Host -ForegroundColor Green -NoNewline "@@A2sr;:;r#5 "; Invoke-Command -ScriptBlock $p7 | |
Write-Host -ForegroundColor Blue -NoNewline " ..:rll: "; Write-Host -ForegroundColor Green -NoNewline "@@A5sr::r3@ "; Invoke-Command -ScriptBlock $p8 | |
Write-Host -ForegroundColor Blue -NoNewline " @Hr;iZ&@@@@ "; Write-Host -ForegroundColor Green -NoNewline ":rr;;;;: "; Invoke-Command -ScriptBlock $p9 | |
Write-Host -ForegroundColor Blue -NoNewline " S@r.:i2&@@@ "; Write-Host -ForegroundColor Yellow -NoNewline "@s . "; Invoke-Command -ScriptBlock $p10 | |
Write-Host -ForegroundColor Blue -NoNewline " @2::ri2A@@# "; Write-Host -ForegroundColor Yellow -NoNewline "B@G2ir:...5i "; Invoke-Command -ScriptBlock $p11 | |
Write-Host -ForegroundColor Blue -NoNewline " :@r,r3X&#@@ "; Write-Host -ForegroundColor Yellow -NoNewline "@G5sr:..,:A "; Invoke-Command -ScriptBlock $p12 | |
Write-Host -ForegroundColor Blue -NoNewline ".@Ar;;rSB@@# "; Write-Host -ForegroundColor Yellow -NoNewline "H#2sr;,..,is "; Invoke-Command -ScriptBlock $p13 | |
Write-Host -ForegroundColor Blue -NoNewline "' & "; Write-Host -ForegroundColor Yellow -NoNewline ",@ASs;:..,:B "; Invoke-Command -ScriptBlock $p14 | |
Write-Host -ForegroundColor Yellow -NoNewline " "; Write-Host -ForegroundColor Yellow -NoNewline ":rr;:.,,.:. "; Invoke-Command -ScriptBlock $p15 | |
Write-Host -ForegroundColor Yellow -NoNewline " "; Write-Host -ForegroundColor Yellow -NoNewline " '`"`"`"' "; Invoke-Command -ScriptBlock $p15 | |
} | |
function screenfetch() { Write-Logo {Write-Host} $userstring $windowsstring $dotnetstring $powershellstring $uptime {Write-Host} $processes $modules $proc $mem $video } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment