{"id":141,"date":"2013-11-22T12:36:35","date_gmt":"2013-11-22T18:36:35","guid":{"rendered":"https:\/\/sysadminnightmare.com\/?p=141"},"modified":"2013-11-22T12:36:35","modified_gmt":"2013-11-22T18:36:35","slug":"powershell-to-check-last-reboot-on-a-windows-server","status":"publish","type":"post","link":"https:\/\/sysadminnightmare.com\/index.php\/2013\/11\/22\/powershell-to-check-last-reboot-on-a-windows-server\/","title":{"rendered":"Powershell to check Last Reboot on a Windows Server"},"content":{"rendered":"<p>Not sure I will ever need to use this again, but needed a way to check who last rebooted a server. <\/p>\n<p>We used this code:<\/p>\n<p><code><br \/>\nGet-EventLog -logname \"system\" | where-object {($_.eventid -eq 1074)} | % {if(($_.TimeGenerated).DayOfYear -eq (get-date).DayOfYear){$_.EventID,$_.TimeGenerated,$_.Message}}<br \/>\n<\/code><\/p>\n<p>Note that event ID 1074 gives you if a user requested a Reboot, if the system crashed there will be no 1074 but a 1076 which is the reason given by the first user to login to the machine.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Not sure I will ever need to use this again, but needed a way to check who last rebooted a server. We used this code: Get-EventLog -logname &#8220;system&#8221; | where-object {($_.eventid -eq 1074)} | % {if(($_.TimeGenerated).DayOfYear -eq (get-date).DayOfYear){$_.EventID,$_.TimeGenerated,$_.Message}} Note that event ID 1074 gives you if a user requested a&#8230; <a class=\"continue-reading-link\" href=\"https:\/\/sysadminnightmare.com\/index.php\/2013\/11\/22\/powershell-to-check-last-reboot-on-a-windows-server\/\"> Continue reading <span class=\"meta-nav\">&rarr; <\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[2,7],"tags":[23],"class_list":["post-141","post","type-post","status-publish","format-standard","hentry","category-admin","category-powershell-2","tag-event-id"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2bgeE-2h","_links":{"self":[{"href":"https:\/\/sysadminnightmare.com\/index.php\/wp-json\/wp\/v2\/posts\/141","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sysadminnightmare.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sysadminnightmare.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sysadminnightmare.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sysadminnightmare.com\/index.php\/wp-json\/wp\/v2\/comments?post=141"}],"version-history":[{"count":0,"href":"https:\/\/sysadminnightmare.com\/index.php\/wp-json\/wp\/v2\/posts\/141\/revisions"}],"wp:attachment":[{"href":"https:\/\/sysadminnightmare.com\/index.php\/wp-json\/wp\/v2\/media?parent=141"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sysadminnightmare.com\/index.php\/wp-json\/wp\/v2\/categories?post=141"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sysadminnightmare.com\/index.php\/wp-json\/wp\/v2\/tags?post=141"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}