Accessing the group description trough powershell

Hi everyone

I'm pretty new to powershell scripting and was wandering if there is a way to access the group description of a security group in active directory.

What I tried for now is the following

$Test = Get-ADGroup "CN=VPN-Group,OU=Remote,DC=ad,DC=corp,DC=com"

write-host $Test.description

The write-host returns nothing but if I remove the .descriptions I see the DN of the group. 

Any suggest would be happly welcome

January 14th, 2014 10:43am

Hi,

Give this a try:

(Get-ADGroup 'Group Name' -Properties description).description

EDIT: If you want to store the information in a variable first, try this:

$group = Get-ADGroup 'Group Name' -Properties description
$group.description

Free Windows Admin Tool Kit Click here and download it now
January 14th, 2014 10:47am

Thans a lot it works just perfect

EDIT: Is there a way to know all the available properties for an object?



January 14th, 2014 11:10am

Sure, you can retrieve all available properties by using a wildcard:

$group = Get-ADGroup 'Group Name' -Properties *

Free Windows Admin Tool Kit Click here and download it now
January 14th, 2014 11:18am

Good to know that really help

Thanks again

January 14th, 2014 11:27am

Cheers, you're very welcome.
Free Windows Admin Tool Kit Click here and download it now
January 14th, 2014 11:32am

An explanation of the difference between default properties (that are always retrieved) and extended properties (that must be requested with the -Properties parameter) for all AD PowerShell module cmdlets (that support the -Properties parameter):

http://social.technet.microsoft.com/wiki/contents/articles/12031.active-directory-powershell-ad-module-properties.aspx

Documentation of all default and extended properties supported by Get-ADGroup (and the LDAP display names of the corresponding AD attributes):

http://social.technet.microsoft.com/wiki/contents/articles/12079.active-directory-get-adgroup-default-and-extended-properties.aspx

Note that  the "Description" property is the alias for the "description" attribute of the Group object in AD, and this is an extended property (so it must be specified with the -Properties parameter of Get-ADGroup).

January 14th, 2014 2:02pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics