Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Filter on Mailboxes and disabled users in AD

$
0
0

Hi, 

 

I am kinda new to powershell. 

 

What I need. 

An Powershell command to retrieve all mailboxes sorted on accounts that is enabled in AD. 

We have an environment where people quits, moves and all sorts of things, so accounts in AD is disabled to be reactivated again in a month or a year. 

 

What's needed. 

To have an up2date list of all mailboxes which currently resides and have an active AD account.

 

What's been tried :

get-mailbox |?{$_.UserAccountControl -Match "AccountDisabled"} |FT Name,Database,UserAccountControl | Out-file C:\path.csv

Did not give any result

These seemed hopefull but commands are not present. 

Search-ADAccount -AccountDisabled | Out-file C:\path.csv 

Get-Aduser -Filter (enabled -ne $true) 

 

Any tips/tricks/winks ?

 

Regards

Jan 


Viewing all articles
Browse latest Browse all 6937

Trending Articles