7

I am having trouble accessing the location property of my Active-Directory's Site via Powershell. (Windows Server 2012 R2)

The following command returns no value:
> (Get-ADReplicationSite "Default-First-Site-Name" | Get-ADObject).location

This command returns an identifier:
> (Get-ADReplicationSite "Default-First-Site-Name" | Get-ADObject).objectGUID

When I am looking into the graphical Attribute Editor of the object in the Active Directory Sites and Services Snap-In, I can verify by the objectGUID-propterty, that I do query the correct AD object and that the location-property is filled.

So why does Powershell return no value and how do I query and edit the location attribute?

9

Because Get-ADObject does not retrieve all attributes by default:

The Get-ADObject cmdlet returns a default set of ADObject property values. To retrieve additional ADObject properties, use the Properties parameter of the cmdlet.

The objectGUID property has a value because it's part of the default property set


You can specify additional properties for Get-ADObject to retrieve with the -Properties parameter:

(Get-ADReplicationSite "Default-First-Site-Name" | Get-ADObject -Properties location).location

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.