title: PowerShell copy AD objectGUID to ms-ds-consistencyguid
body: <p>I am trying to resolve a PowerShell problem that has proved to be more complicated than I first thought. When trying to copy the objectGUID of each domain user into the same users ms-ds-consistencyguid the values do not match. Can anybody help?</p>
  
  <p>I have tried this rough method below but the GUID's do not match:</p>
  
  <pre><code>$SGSADUser=get-aduser -filter {samaccountname -eq 'Test10_User'} -Properties objectguid,samaccountname,ms-ds-consistencyguid | Select Samaccountname,Objectguid,ms-ds-consistencyguid
  
  [guid]$SGSADMSDSConsistencyguid = ($SGSADUser.objectguid).ToString()
  
  $SGSADbase64 = [System.Convert]::ToBase64String($SGSADMSDSConsistencyguid.ToByteArray())
  
  set-aduser -Identity 'Test10_User' -replace @{'ms-ds-consistencyguid' = $SGSADbase64} 
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/mAb5F.png" rel="nofollow noreferrer">ObjectGUID</a><br>
  <a href="https://i.stack.imgur.com/DQfhU.png" rel="nofollow noreferrer">ms-ds-ConsistencyGuid</a></p>