How to list in Powershell all disabled accounts with access to shared mailboxe's ?
Hello,I'm trying to list in Powershell all disabled users from AD with access to shared mailboxe's.Is there any way to list accesses without usingvaraible (static txt file with users)?.Example code for 1 userbeneath:$user_with_permision='*'Get-Mailbox -resultsize unlimited | Get-MailboxPermission -user $* | ft acc*,identity -autoI'll be very thankful for any suggestion.Mac
September 17th, 2009 4:11pm

Please use the commands below, I have tested in the lab (Exchange 2007 SP1): $adobjroot = [adsi]'' $objdisabsearcher = New-Object System.DirectoryServices.DirectorySearcher($adobjroot) $objdisabsearcher.filter = "(&(objectCategory=person)(objectClass=user)(userAccountControl:1.2.840.113556.1.4.803:=2))" $resultdisabaccn = $objdisabsearcher.findall() | sort path $resultdisabaccn | ft -wrap path > c:\disableuser.csv ###Please open the disableuser.csv with notepad, and format the name as below =====Disableuser.csv======= DisableUser James Luo James Li James Bond =====Disableuser.csv======= $Id = Get-Mailbox | select alias $Disableuser = Import-csv C:\ disableuser.csv foreach ($i in $id ) {foreach ($d in $disableuser) {Get-Mailboxpermission -Identity $i.alias -User $d.DisableUser}} Resources: PowerShell script to disable inactive accounts in Active Directory Find Disabled and Inactive User and Computer Accounts using Powershell Part II
Free Windows Admin Tool Kit Click here and download it now
September 18th, 2009 11:19am

You can also try below from Active management shell Get-QADUser -disabled | Export-CSV Disabled users list Get-QADUser -disabled | Select Alias, displayname, Export-CSV Disabled users list Regards, Krishna http://smtpport25.wordpress.com
October 12th, 2009 4:26pm

In Order to list Disable userd we can use the simplest powershell command.get-Mailbox | where { $_.UserAccountControl -match "AccountDisabled"}And it will list all Disabled users in AD and then we can pipe out the output to process the permissions.Manjit Singh BilkhuExchange Admin
Free Windows Admin Tool Kit Click here and download it now
February 3rd, 2010 1:06am

Manjit thanks..it worked.. Krishna We need to have Quest tools to run your cmd
November 13th, 2010 8:32am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics