win-scripts/powerfetch.ps1

19 lines
1.0 KiB
PowerShell
Raw Normal View History

2021-11-02 11:50:09 +01:00
$wmiOS = Get-CimInstance -Class Win32_OperatingSystem
$wmiCS = Get-CimInstance -ClassName Win32_ComputerSystem
$uptime = Get-Uptime
$os = $wmiOS.Caption
$model = $wmiCS.Model
$build = $wmiOS.BuildNumber
$uptimeHours = $uptime.Hours
$uptimeMinutes = $uptime.Minutes
$chocoPackages = choco list -l | Measure-Object -Line
$scoopPackages = scoop.cmd list | Measure-Object -Line
$packages = $($chocoPackages.Lines - 1) + $($scoopPackages.Lines - 3)
Write-Host -ForegroundColor Yellow "$env:username@$env:computername"
Write-Host -ForegroundColor Red "os " -NoNewline; Write-Host -ForegroundColor DarkCyan "$os"
Write-Host -ForegroundColor Red "host " -NoNewline; Write-Host -ForegroundColor DarkCyan "$model"
Write-Host -ForegroundColor Red "build " -NoNewline; Write-Host -ForegroundColor DarkCyan "$build"
Write-Host -ForegroundColor Red "uptime " -NoNewline; Write-Host -ForegroundColor DarkCyan $uptimeHours"h "$uptimeMinutes"m"
2022-02-26 10:33:50 +01:00
Write-Host -ForegroundColor Red "pkgs " -NoNewline; Write-Host -ForegroundColor DarkCyan "$packages (choco + scoop)"