Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

List AD user with or without an Exchange Mailbox

3,248 views
Skip to first unread message

Personne

unread,
Dec 22, 2008, 8:32:43 PM12/22/08
to
so far I got this

GET-QADuser | Get-mailbox

I got a red message when the user doesn't have a mailbox associated

I'm also looking to delete a mailbox without deleting the AD user, I
go this command Remove-mailbox, but it does delete the mailbox and the
AD user associated


Personne

unread,
Dec 23, 2008, 1:09:24 AM12/23/08
to
I've found this

get-qaduser -Include msExchHomeServerName | where { !
$_.msExchHomeServerName}

should also work with
homeMDB
homeMTA

Shay Levy [MVP]

unread,
Dec 23, 2008, 2:07:45 AM12/23/08
to
Hello Personne,

Get-QADUser's Identity is not the same as Get-Mailbox's Identity, you need
to use foreach and set the -errorAction parameter
to silentlyContinue to supress error messages for non mailboxed users


Get-QADUser | foreach { Get-Mailbox $_.name -ErrorAction silentlyContinue }


On the other hand, exchange has a built-in Get-User cmdlet which you can
pipe directly to Get-Mailbox (use -errorAction as above to supress error
messages)

Get-User | Get-Mailbox -errorAction silentlyContinue


---
Shay Levy
Windows PowerShell MVP
http://blogs.microsoft.co.il/blogs/ScriptFanatic
PowerShell Toolbar: http://tinyurl.com/PSToolbar


P> so far I got this
P>
P> GET-QADuser | Get-mailbox
P>
P> I got a red message when the user doesn't have a mailbox associated
P>
P> I'm also looking to delete a mailbox without deleting the AD user, I
P> go this command Remove-mailbox, but it does delete the mailbox and
P> the AD user associated
P>


Personne

unread,
Dec 23, 2008, 3:01:28 AM12/23/08
to
Hi Shay,

I've found this, which works great

Personne

unread,
Dec 23, 2008, 3:06:41 AM12/23/08
to
or
get-user -Filter {Recipienttype -eq "User"}

Personne

unread,
Dec 23, 2008, 3:05:44 AM12/23/08
to
I've found this, which works great

get-qaduser -Include msExchHomeServerName | where { !
$_.msExchHomeServerName}

or even

Shay Levy [MVP]

unread,
Dec 23, 2008, 3:16:07 AM12/23/08
to
Hello Personne,

Using where-object return ALL users and then filters them. You can give your
command performance boost by
quering the msExchHomeServerName attribute on the server (using ldap filter,
returning just the users that meet the criteria:

Get-QADUser -sizeLimit 0 -ldap "(!msExchHomeServerName=*)"


---
Shay Levy
Windows PowerShell MVP
http://blogs.microsoft.co.il/blogs/ScriptFanatic
PowerShell Toolbar: http://tinyurl.com/PSToolbar


P> Hi Shay,
P>
P> I've found this, which works great
P>
P> get-qaduser -Include msExchHomeServerName | where { !
P> $_.msExchHomeServerName}
P>


Personne

unread,
Dec 23, 2008, 3:26:03 AM12/23/08
to
get-qaduser -Include msExchHomeServerName | where { !
$_.msExchHomeServerName}
=> Return enabled and disabled user

get-user -Filter {Recipienttype -eq "User"}

=> Return enabled and disabled user

get-user -RecipientTypeDetails User
=> Return only enabled

Shay Levy [MVP]

unread,
Dec 23, 2008, 3:20:03 AM12/23/08
to
Hello Personne,

That's much better :-), also set the -ResultSize parameter to 'unlimited'
to get the maximum number of user objects.

---
Shay Levy
Windows PowerShell MVP
http://blogs.microsoft.co.il/blogs/ScriptFanatic
PowerShell Toolbar: http://tinyurl.com/PSToolbar


P> or
P> get-user -Filter {Recipienttype -eq "User"}


Personne

unread,
Dec 23, 2008, 3:31:11 AM12/23/08
to
Seems they are plenty of way to do it

I just find out that:


get-qaduser -Include msExchHomeServerName | where { !

$_.msExchHomeServerName}
or


get-user -Filter {Recipienttype -eq "User"}

Doesn't return the exact same number of entry !

Anyway I've tried this:
$x=get-qaduser -Include msExchHomeServerName | where { !
$_.msExchHomeServerName} | select name | sort name
$t=get-user -Filter {Recipienttype -eq "User"} | select name | sort
name
Compare-object $x $t

First time I'm using compare-object, not sure how it works, but it
doesn't seems to return the difference between $t and $x

I'll double check tomorrow.

Personne

unread,
Dec 23, 2008, 3:31:41 AM12/23/08
to
Seems they are plenty of way to do it

I just find out that:

get-qaduser -Include msExchHomeServerName | where { !

Personne

unread,
Dec 23, 2008, 3:46:06 AM12/23/08
to
Seems they are plenty of way to do it

I just find out that:

get-qaduser -Include msExchHomeServerName | where { !

Personne

unread,
Dec 23, 2008, 10:34:09 AM12/23/08
to
Sorry for my triple double post, I do not know what happened
0 new messages