How to get multiple user mS-DS-ConsistencyGuid GUID in hexa format

Vivek Kumar Sharma 1 Reputation point
2020-12-08T19:50:20.003+00:00

How to get multiple user mS-DS-ConsistencyGuid GUID in hexa format

So far I reached --($user has UPN values)

$u=foreach($u in $user)
{
Get-ADuser -Filter {mail -like $u} -Properties samaccountname,UserPrincipalName,mS-DS-ConsistencyGuid | select samaccountname,UserPrincipalName, @{N="mS-DS-ConsistencyGuid";E={$_.'mS-DS-ConsistencyGuid'}}

}

$u | epcsv .\User_guid.csv -NTI -Force

===================================

BUT i would like this guid in other formats including hex, done in same loop.

Also, i may be updating these users with ms-ds guid if the one retrieved does not meet in excel file?

Anyone have idea on this?

Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
6,443 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,510 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
21,416 questions
{count} votes

1 answer

Sort by: Most helpful
  1. 2020-12-08T21:42:05.393+00:00

    Hello @Vivek Kumar Sharma . Add this to your select statement:

    @{N="mS-DS-ConsistencyGuid-ByteArray"; E={[String]::Join(",",($_.'mS-DS-ConsistencyGuid'|Out-String|Format-Hex).Bytes)}

    Regarding "Also, i may be updating these users with ms-ds guid if the one retrieved does not meet in excel file?". What do you mean?


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.