Exchange Exchange
A community dedicated to Exchange and related technology.

Creating "system policy" scripts

Not Answered This post has 0 verified answers | 0 Replies | 1 Follower

Top 10 Contributor
Points 3,290
Joel Stidley posted on 09-18-2006 1:12 PM

System Policies in Exchange 2007... with PowerShell

System policies didn't make the trip from Exchange 2003 to Exchange 2007.  However there is something that is far more flexible and powerful that can easily replace system policies.... PowerShell!

System Policies allowed you to set standard for Mailbox Stores so that you could just set the policy once and not have to worry that the settings would differ from store.  Essentially you can create a couple of standards PowerShell Scripts and schedule them with Windows Scheduler (AT).  I have a simple example that I wrote up for Exchange 2007 beta 2.

SetExecPolicy.msh (later version of PowerShell use the .ps1 file extension)

$MBItems = get-content -path $args[0]

foreach ($objItem in $MBItems) {
set-mailboxdatabase $objitem -IssueWarningQuota 300MB -ProhibitSendQuota 400MB -ProhibitSendReceiveQuota 600MB -ItemRetention 21.00:00:00 -MailboxRetention 21.00:00:00 -RetainDeletedItemsUntilBackup:$true 

}

Also, create a text file with the list of stores you want to apply this policy to.  In this file you should list the stores each on its own line in this format: ServerName\Storage Group\Mailbox Store

ExecStores.txt

EXC007\SG01\MB01

EXC007\SG03\MB03

Now, create a scheduled task that runs "SetExecPolicy.msh ExecStores.txt" every 2 hours (or at any interval you think fits).  This will make sure that each store listed in the ExecStores.txt file gets your standard settings.  If you need to add or subtract a store from the list, all you need to do is adjust the TXT file, no need to modify the script.   

You can take this further and create a script and a text file for each standard you have and schedule it to be applied.  As an example you might create a SetStandardPolicy.msh that sets a lower mailbox limit or maybe a different retention policy.  You could even forgo setting the limits on the store and create a similar script to just set settings on a list of users... and the list of users can be retrieved directly from AD.  There are a lot more settings and complexities you can set with this same process... drop me a line and suggest something.

 

- Joel

  • | Post Points: 0

All Replies

Page 1 of 1 (1 items) | RSS
© 2003-2008 NamedPipes Consulting. All other company and product names are property of their owners.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems