views:

1868

answers:

6

When I run get-user|get-member in powershell with the exchange add-in I noticed there is no description property.

Does anyone know if it has been renamed to something else or another way of accessing it?

A: 

get-user? do you mean get-qaduser from the quest cmdlet suite?

if so, I believe not all properties are retrieved by default. There's an -Include parameter that lets you specify additional properties to retrieve from AD, IIRC.

x0n
A: 

I'm sorry, i'm a newbie to powershell. I'm not familiar with quest cmdlet suite. I'm guessing its a add-in library for powershell..

My goal is to create a function which pulls the office and the description property for each Active Directory user when I run get-Mailboxstatistics.

I'm just using regular powershell commandline.

phill
add-user is not part of the regular command line in powershell. But now because you mentioned mailboxes, you obviously mean the Exchange shell, not vanilla powershell. You should change your original question to say this.
x0n
+3  A: 

If you aren't looking to change the description this should work:

[PS] C:\>$ANR = "[email protected]"
[PS] C:\>$foo = [adsi]("LDAP://" + (get-user $ANR).DistinguishedName)
[PS] C:\>$foo.description
My Description

If you are wanting to edit, you will need to get further into System.DirectoryServices & look at how to write objects back to AD. It would likely be simpler to use quest of another package that does some wrapping. If you want to roll your own there are gobs of blogs on AD programming in Powershell.

slipsec
+1  A: 

Exchange itself provides minimal interaction with AD - essentially, it gives you some AD stuff because AD and Exchange are so connected, but it doesn't try to expose all of AD's functionality.

Check out quest.com/powershell; that is an add-in library (it's free), and it has a cmdlet called Get-QADUser which will get you what you need - somewhat more easily, and in a more PowerShell-ish fashion, than using ADSI (which is also completely legit for what you're after).

Don Jones
But is it "really" even adsi if the object returned is a DirectoryServices.DirectoryEntry? All things become fuzzy, all edges blurred :)
slipsec
A: 

It works on the console; however in the CSV file, it keeps appending

System.DirectoryServices.PropertyValueCollection

to the end of each line instead of the value When I run it on the prompt by typing out the distinguishedname, the ldap query works..

$tmp =adsi $tmp.description bill

any ideas?

phill
A: 

solved it.. its just $tmp.description.value

phill