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
get-qaduser -Include msExchHomeServerName | where { !
$_.msExchHomeServerName}
should also work with
homeMDB
homeMTA
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>
I've found this, which works great
get-qaduser -Include msExchHomeServerName | where { !
$_.msExchHomeServerName}
or even
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>
get-user -Filter {Recipienttype -eq "User"}
=> Return enabled and disabled user
get-user -RecipientTypeDetails User
=> Return only enabled
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"}
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.
I just find out that:
get-qaduser -Include msExchHomeServerName | where { !
I just find out that:
get-qaduser -Include msExchHomeServerName | where { !