views:

2671

answers:

5

I just recently found out that exchange server2007 will no longer be supporting WMI, namely the service which uses \ROOT\MicrosoftExchangeV2. The old script I wrote output the ServerName, StorageGroupName, Storename, MailboxDisplayName, Size, TotalItems, DeletedMessageSizeExtended fields to a csv text file.

How would I go about doing this in Powershell?

I found you can do this in the 2007 Exchange Management Console running Get-MailboxStatistics | FT database, DisplayName, ItemCount, TotalItemSize | out-file textfile1.txt

which generates some of the exchange fields. HOw do i go about generating the rest of the Active Directory fields like the description and Office fields found in active directory for the same user in the exchange database and output it to a txt file?

A: 

The Quest PowerShell cmdlets (quest.com/powershell) are probably the best way. You can use Get-QADUser -IncludeAllProperties to get all of the AD attributes for a user, including Office, Description, etc. Keep in mind that it's AD that has this info, not Exchange.

Exchange cmdlets (Get-Mailbox) will get a certain amount of information for you, but Exchange cmdlets are really focused on just the Exchange bits as much as possible.

Don Jones
where would be a good source to go to look for a beginner intro on how to use Quest Powershell cmdlets?
phill
TurboChargeAD.org, which is affiliated with Quest, has a weekly tip on using the cmdlets. They also ship with excellent help, and PowerGUI.org provides (lightweight) support for them in their forums. (Sorry it took so long to get back on this - didn't see your comment)
Don Jones
+1  A: 

And BTW... depending on how you want to format this information it might be better to write a function which gets the user info, then the Exchange info, and then combines that together into a custom object. PowerShell can then take care of outputting and formatting it for you in various ways. My PowerShell column at http://technet.microsoft.com/en-us/magazine/dd228985.aspx goes into exactly that - combining information from multiple places into consolidated output. I also have some blog posts on the subject (look up "evolution" in the search, I think) at ConcentratedTech.com.

Don Jones
A: 

You can also use the Get-User exchange cmdlet to get a partial list of user AD properties:

PS > get-user | get-member

Shay Levy
A: 

This is probably a very basic question

I noticed when I run :

get-user | get-member

it lists the properties and methods available to the object; however, how do I go about accessing the available methods?

phill
A: 

I figured it out..

Its something as simple as this

Get-User |select name, office

phill
Actually, that's not getting you methods - it's still properties. If there's a method "Foo", you'd do... Get-Whatever | ForEach-Object { $_.Foo() }
Don Jones