views:

1167

answers:

1

i start out by querying an exchange server 2003 with:

POSH>get-wmiobject -class Exchange_mailbox -namespace Root\MicrosoftExchangeV2 -server srv02

to get the users. One of the properties available is the mailboxguid. so for testing, I run

POSH> get-qaduser -identity <mailboxguid>

however it doesn't work. is there something special I need to do to the mailboxguid?

thanks in advance

+1  A: 

Get-QADUser tries to resolve an object by one of these properties: DN, SID, GUID, UPN or Domain\UserName, mailboxguid is not one of them. That said, you can use the mailbox "MailboxDisplayName" property as the identity for Get-QADUser:

get-wmiobject -class Exchange_mailbox -namespace Root\MicrosoftExchangeV2 -server srv02 | Get-QADUser -identity {$_.MailboxDisplayName}

EDIT: Try to parse the LegacyDN WMI property if you can't use MailboxDisplayName:

get-wmiobject -class Exchange_mailbox -namespace Root\MicrosoftExchangeV2 -computerName srv02| Get-QADUser -identity {$.LegacyDN.substring($.LegacyDN.lastIndexOf("=")+1)}

btw, replace -server with -computerName, Get-WMIObject has no -server parameter. I addition you could go the other way and not use WMI to get mailbox enabled objects, you can query AD directly:

Get-QADObject -sizeLimit 0 -ldap "(homeMDB=*)"

Shay Levy
I was hopingthere was a more accurate way of doing this other than mailboxdisplayname because they don't always match. Is there another more accurate alternative like say getting exchange 2007 powershell to pull the same mailbox-activedirectory info on exchange 2003 servers?
phill
when I run it against the legacydn property i get an error: invalid variable reference. "$" was not followed by a valid variable name character. consider using $() to delimit the name.
phill
Phill, the post editor doesn't like the dollar+underscore combination (e.g $_), it is dropping the "_" char. Try t6o add it back, I checked it and it work.
Shay Levy
It looks like it cleared up the errors, however its pulling the users from the wrong domain. any ideas how to change this? thanks in advance..
phill