Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- # show-uptime.ps1
- #
- $uptime = @{}
- gwmi win32_operatingsystem | % {
- $uptime.OS = $_.caption
- $uptime.VER = $_.version
- $uptime.SP = $_.servicepackmajorversion
- $uptime.INS = ([wmi]'').converttodatetime((gwmi win32_operatingsystem).installdate)
- new-timespan -st ([wmi]'').converttodatetime((gwmi win32_operatingsystem).lastbootuptime) -en $( get-date ) | % {
- $uptime.UP = '{0:00} days, {1:00}:{2:00}:{3:00}' -f $_.days,$_.hours,$_.minutes,$_.seconds
- }
- }
- new-object -t psobject -p $uptime | fl OS,VER,SP,INS,UP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement