Windows system up time
Invoke-Command -ScriptBlock { $ut = (get-date) - (gcim Win32_OperatingSystem).LastBootUpTime $tz = [System.TimeZone]::CurrentTimeZone Write-Host "`r`nHostname:" $(hostname) Write-Host "Timezone:" $tz.StandardName " / " $tz.DaylightName Write-Host "Up time: " $ut.Days " Days " $ut.Hours " Hours " $ut.Minutes " Minutes `r`n" } Sample Output: Hostname: Computer1 Timezone: Romance Standard Time / Romance Daylight Time Up time: 4 Days 22 Hours 51 Minutes
Get top 5 high CPU usage processes
Get-Process | Sort CPU -descending | Select -first 5 -Property ID, ProcessName, Description, CPU | Format-List=================================Expected outputId : 2140 ProcessName : chrome Description : Google Chrome CPU : 681.109375 Id : 7032 ProcessName : mcshield Description : CPU : 649.71875 Id : 5016 ProcessName : dptf_helper Description : Intel(R) Dynamic Tuning Utility Application CPU : 516.328125
No comments:
Post a Comment