Quick and Dirty Mailbox Storage Quota updates with ActiveRoles and PowerShell

If you have a need to set a large number of mailbox storage quotas, it can be done quickly and easily with the Quest ActiveRoles cmdlets for Windows PowerShell.  In my example below I am actually running the changes through Quest ActiveRoles Server, so you’ll see that the code connects to the ActiveRoles Service and outputs the Operation Status and Operations ID that ActiveRoles assigns it.  The Quest ActiveRoles management shell is also compatible with native AD though, so if you remove the line ‘Connect-QAD Service -Proxy’ and the references to Operations Status and Operation ID, it should work just fine for you.  I emphasise should because I haven’t tested it and would definitely recommend you test if yourself before running it in production.

It may not be perfect but like the title says, quick and dirty.  Here’s how I did it, copy the following into a new script file and save as StorageQuota.ps1:


################################################################## ## Configure your CSV as follows (remember to make sure the path ## and file name is correct). ## ## Name,IssueWarning,ProhibitSend,ProhibitSendReceive ## domain\User1,50000,60000,100000 ## domain\User2,50000,60000,100000 ## ## This code will read each user in the CSV and update the values ## accordingly, displaying the Operation ID and Status for later ## reference and recording a transcript of the session. ################################################################## Start-Transcript d:\StorageQuotaLog.txt Connect-QADService -Proxy $QuotaUpdates = Import-Csv d:\StorageQuota.csv $QuotaUpdates | Foreach-Object {Get-QADUser -identity $_.'Name' -IncludedProperties mDBUseDefaults,mDBStorageQuota,mDBOverQuotaLimit,mDBOverHardQuotaLimit | Set-QADUser -objectAttributes @{mDBUseDefaults=$false;mDBStorageQuota=$_.'IssueWarning';mDBOverQuotaLimit=$_.'ProhibitSend';mDBOverHardQuotaLimit=$_.'ProhibitSendReceive'} | Select-Object Name,sAMAccountName,OperationStatus,OperationID } Stop-Transcript

HTML code

Advertisements


Categories: Active Directory, ActiveRoles, Powershell

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: