Delete Exchange mailbox and Ad account for the give list of users

rated by 0 users
This post has 0 Replies | 1 Follower

Top 25 Contributor
Posts 211
Top Contributor
Krishna Posted: 06-09-2009 10:34 AM

http://smtpport25.wordpress.com/2009/06/01/delete-exchange-mailbox-and-ad-account-for-the-give-list-of-users/

Below is the command to delete Both Exchange mailbox and Active Directory Account with the single commant from the given list of users in the text file.

Get-content  “C:\Powershell\Users.txt” | Remove-Mailbox

Below command will the get list of users in the disabled state and modified date is older then 10 days and deletes the same

Get-Mailbox -ResultSize unlimited |?{$_.useraccountcontrol -match “AccountDisabled, NormalAccount”} |?{$_.WhenChanged -lt (get-date).AddDays(-10)} |Remove-Mailbox

Regards,
Krishna
http://smtpport25.wordpress.com

Page 1 of 1 (1 items) | RSS
Copyright 2012 PowerShell.com. All rights reserved.