Posted by on October 30, 2014

The ObjectGUID property of an AD object is weird. I tried using -Expand and foreach{$_.ObjectGUID} to extract the value, but neither did quite what I expected. Here’s how I was able to get the value of that property into a string variable that I could then use for something useful.

$uGuid = (Get-ADUser <username> | Select -Expand ObjectGUID).toString()

The value of $uGuid will be the string value of ObjectGUID and not the System.Object Guid or System.Object objectguid.

Comments

Be the first to comment.

Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*