# Security Patch/KB Install Date

There may be times when you need to determine when a security update was installed. This is obviously a lot easier if you had access to a live machine to run live queries (see [here ](https://osd365.com/a-powershell-script-to-list-all-installed-microsoft-windows-updates/)for PowerShell queries) however that's not always possible. You may only have a limited logical collection, triage collection (collected by CyLR/UAC etc), or are working from a limited backup.

Installed security packages are located at the following location;

```
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages
```

Each key references a specific package

![](https://3710248095-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MAcqFKR60dGwoJxmUG5%2Fuploads%2FX5dIYA4gz2IeGXaTojQs%2Fimage.png?alt=media\&token=ce977e0a-4d30-4c6b-b343-80220dc8f8c5)

Keys may contain the following values;

* SelfUpdate (0 for manual updates, 1 for automatic updates)
* InstallTimeHigh
* InstallTimeLow
* InstallUser (SID of the user who installed the package)

Even though the key "Package\_8\_for\_KB4033393\~..." contains a corresponding 'last write timestamp' of **2022-07-14 01:47:25 (UTC)**, I wanted to validate this against the values within the key itself based on the InstallTimeHigh and InstallTimeLow timestamps.

I found a BigFix article which referenced the following formula used to calculate the corresponding timestamp.

`Timestamp = InstallTimeHigh * 2^32 + InstallTimeLow`

2 ^ 32 is 4294967296

In the above example, our formula would look like this;

`Timestamp = (30971683 * 4294967296) + 2864280153`

`Timestamp = (133022365587079168) + 2864280153`

`Timestamp = 133022368451359321`

<div align="center"><img src="https://3710248095-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MAcqFKR60dGwoJxmUG5%2Fuploads%2FgNhBuYDrpBdgB9KV2GEA%2Fimage.png?alt=media&#x26;token=7e505e65-f0c7-42e6-98b4-dead49b9f002" alt=""></div>

Converter: <https://www.epochconverter.com/ldap>

:exclamation:Note: if you mount the SOFTWARE hive on another machine and export the key/value as a text file, the corresponding date/timestamp will be adjusted for the host machine's local time.:exclamation:

![](https://3710248095-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MAcqFKR60dGwoJxmUG5%2Fuploads%2FUPOZzzuVtHfDgJQPliz0%2Fimage.png?alt=media\&token=95a4e439-28aa-447a-9ef9-7ad33f5bba10)
