Upload files to "/"
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
# ShowComputerInfo.ps1
|
||||
|
||||
Write-Host "==========================================" -ForegroundColor Cyan
|
||||
Write-Host " RAPORT O STANIE KOMPUTERA" -ForegroundColor Cyan
|
||||
Write-Host "==========================================" -ForegroundColor Cyan
|
||||
|
||||
# 1. Zużycie miejsca na dysku C:
|
||||
$diskC = Get-CimInstance Win32_LogicalDisk -Filter "DeviceID='C:'"
|
||||
$totalDiskGb = [math]::Round($diskC.Size / 1GB, 2)
|
||||
$freeDiskGb = [math]::Round($diskC.FreeSpace / 1GB, 2)
|
||||
$usedDiskGb = $totalDiskGb - $freeDiskGb
|
||||
$diskPercent = [math]::Round(($usedDiskGb / $totalDiskGb) * 100, 1)
|
||||
|
||||
$diskColor = if ($diskPercent -ge 90) { "Red" } elseif ($diskPercent -ge 75) { "Yellow" } else { "Green" }
|
||||
Write-Host "Dysk C: " -NoNewline
|
||||
Write-Host "$usedDiskGb GB zajęte z $totalDiskGb GB ($diskPercent%)" -ForegroundColor $diskColor
|
||||
|
||||
# 2. Liczba zalogowanych użytkowników (interaktywnych)
|
||||
$loggedUsers = (Get-Process explorer -ErrorAction SilentlyContinue).Count
|
||||
$userColor = if ($loggedUsers -gt 0) { "Yellow" } else { "Green" }
|
||||
Write-Host "Użytkownicy: " -NoNewline
|
||||
Write-Host "$loggedUsers zalogowanych sesji graficznych" -ForegroundColor $userColor
|
||||
|
||||
# 3. Czas działania (Uptime) i ostatni restart
|
||||
$os = Get-CimInstance Win32_OperatingSystem
|
||||
$lastBoot = $os.LastBootUpTime
|
||||
$uptime = (Get-Date) - $lastBoot
|
||||
Write-Host "Uptime: " -NoNewline
|
||||
Write-Host "$($uptime.Days) dni, $($uptime.Hours) godz, $($uptime.Minutes) min (Uruchomiono: $lastBoot)" -ForegroundColor White
|
||||
|
||||
# 4. Zużycie RAM
|
||||
$totalRamGb = [math]::Round($os.TotalVisibleMemorySize / 1MB, 2)
|
||||
$freeRamGb = [math]::Round($os.FreePhysicalMemory / 1MB, 2)
|
||||
$usedRamGb = $totalRamGb - $freeRamGb
|
||||
$ramPercent = [math]::Round(($usedRamGb / $totalRamGb) * 100, 1)
|
||||
|
||||
$ramColor = if ($ramPercent -ge 90) { "Red" } elseif ($ramPercent -ge 75) { "Yellow" } else { "Green" }
|
||||
Write-Host "RAM: " -NoNewline
|
||||
Write-Host "$usedRamGb GB zajęte z $totalRamGb GB ($ramPercent%)" -ForegroundColor $ramColor
|
||||
|
||||
Write-Host "==========================================" -ForegroundColor Cyan
|
||||
Reference in New Issue
Block a user