How do I find the install time and date of Windows?

后端 未结 20 1178
孤街浪徒
孤街浪徒 2020-12-12 11:36

This might sound like a little bit of a crazy question, but how can I find out (hopefully via an API/registry key) the install time and date of Windows?

The best I c

20条回答
  •  独厮守ぢ
    2020-12-12 12:09

    You can do this with PowerShell:

    Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\' -Name InstallDate |
        Select-Object -Property @{n='InstallDate';e={[DateTime]::new(1970,1,1,0,0,0,0,'UTC').AddSeconds($_.InstallDate).ToLocalTime()}}
    

提交回复
热议问题