{"id":873,"date":"2023-07-03T10:37:49","date_gmt":"2023-07-03T08:37:49","guid":{"rendered":"https:\/\/www.gccdat.be\/main\/?p=873"},"modified":"2023-07-03T10:38:51","modified_gmt":"2023-07-03T08:38:51","slug":"powershell-shop-last-boot-date-time","status":"publish","type":"post","link":"https:\/\/www.gccdat.be\/main\/2023\/07\/03\/powershell-shop-last-boot-date-time\/","title":{"rendered":"Powershell Show Last Boot Date Time"},"content":{"rendered":"\n<p>Two different ways to retrieve the uptime of your system.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$time = (get-date) - (gcim Win32_OperatingSystem).<strong>LastBootUpTime\n<\/strong>\n$time\n\nFunction Get-Uptime {\n$os = Get-WmiObject win32_operatingsystem -ErrorAction SilentlyContinue\n$uptime = (Get-Date) - $os.ConvertToDateTime($os.LastBootUpTime)\nWrite-Output (\"Last boot: \" + $os.ConvertToDateTime($os.LastBootUpTime) )\nWrite-Output (\"Uptime   : \" + $uptime.Days + \" Days \" + $uptime.Hours + \" Hours \" + $uptime.Minutes + \" Minutes\" )\n}\n\n<strong>Get-Uptime<\/strong><\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Two different ways to retrieve the uptime of your system.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,6],"tags":[74,73],"class_list":["post-873","post","type-post","status-publish","format-standard","hentry","category-algemeen","category-development","tag-boot","tag-uptime"],"_links":{"self":[{"href":"https:\/\/www.gccdat.be\/main\/wp-json\/wp\/v2\/posts\/873","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gccdat.be\/main\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gccdat.be\/main\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gccdat.be\/main\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gccdat.be\/main\/wp-json\/wp\/v2\/comments?post=873"}],"version-history":[{"count":2,"href":"https:\/\/www.gccdat.be\/main\/wp-json\/wp\/v2\/posts\/873\/revisions"}],"predecessor-version":[{"id":875,"href":"https:\/\/www.gccdat.be\/main\/wp-json\/wp\/v2\/posts\/873\/revisions\/875"}],"wp:attachment":[{"href":"https:\/\/www.gccdat.be\/main\/wp-json\/wp\/v2\/media?parent=873"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gccdat.be\/main\/wp-json\/wp\/v2\/categories?post=873"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gccdat.be\/main\/wp-json\/wp\/v2\/tags?post=873"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}