Reading 4K-Hash

by Aug 6, 2020

Windows operating systems can be uniquely identified by a so-called 4K-Hash: this is a special hash string that is 4000 bytes in size. You can use this hash for example with “Windows Autopilot” to add physical and virtual machines.

The 4K Hash is just one piece of information required to register Windows machines yet it may be interesting by itself to uniquely identify Windows operating systems for other purposes, too. The code below reads the unique 4K-Hash via WMI (Administrator privileges required):

$info = Get-CimInstance -Namespace root/cimv2/mdm/dmmap -Class MDM_DevDetail_Ext01 -Filter "InstanceID='Ext' AND ParentID='./DevDetail'" 
$4khh = $info.DeviceHardwareData


Since Get-CimInstance supports remoting, you can read this value from remote systems, i.e. virtual machines, as well.

Twitter This Tip! ReTweet this Tip!