Powershell piping query


We are using Quest Powershell. An object has SIDvalue 1234. The name is User1.

So if I run:

get-QADUser -identity User1 | fl

One of the returned values is:

objectGUID: 1234

Now, what I need to do is find a Powershell command that will return the "DisplayName" attribute if I know the objectGUID.

Does anyone know how I can do this?

And, if I have a list of objectGUID's in a file named GUID.csv, how can I do the above?

Any help really appreciated!
Who is Participating?
Chris DentConnect With a Mentor PowerShell DeveloperCommented:
Quest stores it in two different values. The first is the real one, objectGUID, the second is "Guid" and is the better format.

Using that you can do this:

Get-QADUser (Get-QADuser "Chris Dent").GUID

What's in your file exactly? GUID's in this format?


If so, you can simply use Get-QADUser to get the lot. If not, you'd be better converting the entry to a real System.GUID object before trying to pass it in.

Someone has put together a function for exactly this. See here. Customise that to your needs.
Hi ,

Try the following commands

get-qaduser -includeProperty ObjectGUID | where{$_.ObjectGuid -eq '1234'} | FL DisplayName, ObjectGuid

or user IncludeAllProperties instead of IncludeProperty

For a list of Guid in a csv file you can use for loop, for example guid is specified under column GUID in CSV file

Import the csv file into a var
$ColItems = import-csv D:\FileName.csv
foreach($colItem in $colItems)
           $objGuid = $colItem.GUID
           get-qaduser -includeProperty ObjectGuid | where{$_.ObjectGuid -eq "$objGuid"} | FL  DisplayName, ObjectGuid


Note: First test on few users.

Navdeep [v-2nas]
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

Chris DentPowerShell DeveloperCommented:
Since the objectGUID is a unique reference you should simply be able to do:

Get-QADUser <objectGUID> | Select-Object DisplayName

neil4933Author Commented:
Hi v-nas, that doesn't work.

Chris, thanks but Quest doesn't seem to work with objectGUID in that way, even though it is unique.

So, to confirm:

get-QADUser -identity User1 | fl objectGUID

objectGUID: 1234

There must be a straightforward Powershell to run that says "Get-QADUser where objectGUID is 1234"?

Thanks in advance?
Quest converts the object guid to hex format which is why it isn't working. If you do the following it will work.

$guid = (get-qaduser username).objectguid
Get-qaduser $guid

That should work.
Given that you use the Guid in valid system input, the code will work.

Navdeep [v-2nas]
All Courses

From novice to tech pro — start learning today.