{"id":1370,"date":"2016-01-10T22:49:59","date_gmt":"2016-01-11T03:49:59","guid":{"rendered":"http:\/\/enterpriseadmins.org\/blog\/?p=1370"},"modified":"2020-11-22T09:59:11","modified_gmt":"2020-11-22T14:59:11","slug":"find-esxi-installation-date-with-powercli","status":"publish","type":"post","link":"https:\/\/enterpriseadmins.org\/blog\/scripting\/find-esxi-installation-date-with-powercli\/","title":{"rendered":"Find ESXi Installation Date with PowerCLI"},"content":{"rendered":"<p>I recently noticed a link to a very interesting article on Twitter: <a href=\"http:\/\/vcdx56.com\/2016\/01\/05\/find-esxi-installation-date\/\">Find ESXi Installation Date &#8212; http:\/\/vcdx56.com\/2016\/01\/05\/find-esxi-installation-date\/<\/a>. These steps are straight forward and show how to calculate the original ESXi install date, looking at the first section of the UUID. I didn&#8217;t realize so much useful information was coded into the UUID, but this could be useful information for certain reports. To understand the process, please <a href=\"http:\/\/vcdx56.com\/2016\/01\/05\/find-esxi-installation-date\/\">check out the original article on vcdx56.com<\/a>.<\/p>\n<p>The following few lines of code will return this information for all hosts in a vCenter using PowerCLI.<\/p>\n\n\n<pre class=\"wp-block-code\"><code># Find ESXi install date: http:\/\/vcdx56.com\/2016\/01\/05\/find-esxi-installation-date\/\n# Convert HEX to DEC: http:\/\/michaelflanakin.com\/Weblog\/tabid\/142\/articleType\/ArticleView\/articleId\/1073\/Converting-ToFrom-Hex-with-PowerShell.aspx\n# Convert epoch to date: http:\/\/stackoverflow.com\/questions\/10781697\/convert-unix-time-with-powershell\n\nGet-VMHost | Sort Name | %{\n  $thisUUID = (Get-EsxCli -VMHost $_.name).system.uuid.get()\n  $decDate = &#91;Convert]::ToInt32($thisUUID.Split(\"-\")&#91;0], 16)\n  $installDate = &#91;timezone]::CurrentTimeZone.ToLocalTime((&#91;datetime]'1\/1\/1970').AddSeconds($decDate))\n  &#91;pscustomobject]&#91;ordered]@{\n    Name=\"$($_.name)\"\n    InstallDate=$installDate\n  } # end custom object\n} # end host loop<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I recently noticed a link to a very interesting article on Twitter: Find ESXi Installation Date &#8212; http:\/\/vcdx56.com\/2016\/01\/05\/find-esxi-installation-date\/. These steps are straight forward and show how to calculate the original ESXi install date, looking at the first section of the &hellip; <a href=\"https:\/\/enterpriseadmins.org\/blog\/scripting\/find-esxi-installation-date-with-powercli\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[3,4],"tags":[],"class_list":["post-1370","post","type-post","status-publish","format-standard","hentry","category-scripting","category-virtualization"],"_links":{"self":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/1370","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/comments?post=1370"}],"version-history":[{"count":3,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/1370\/revisions"}],"predecessor-version":[{"id":1568,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/1370\/revisions\/1568"}],"wp:attachment":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/media?parent=1370"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/categories?post=1370"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/tags?post=1370"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}