Reputation: 13844
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?
Upvotes: 0
Views: 6595
Reputation: 13844
I figured it out..
Its something as simple as this
Get-User |select name, office
Upvotes: 0
Reputation: 126722
You can also use the Get-User exchange cmdlet to get a partial list of user AD properties:
PS > get-user | get-member
Upvotes: 0
Reputation: 9497
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.
Upvotes: 1
Reputation: 9497
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.
Upvotes: 0