PoshCode Logo PowerShell Code Repository

ScriptingAgentConfig.xml by Jan Egil Ring 6 years ago
embed code: <script type="text/javascript" src="http://PoshCode.org/embed/2308"></script>download | new post

Sample ScriptingAgentConfig.xml for working with the Exchange Server 2010 Scripting Agent cmdlet extension agent.

For more details, see the following blog-post:
http://blog.powershell.no/2010/10/17/using-cmdlet-extension-agents-to-customize-mailbox-provisioning

  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <Configuration version="1.0">
  3.  
  4. <Feature Name="MailboxProvisioningDatabase" Cmdlets="new-mailbox">
  5.   <ApiCall Name="ProvisionDefaultProperties">
  6.  
  7. #Regex switch to decide mailboxdatabase based on the user specified Name-attribute
  8. switch -regex (($provisioningHandler.UserSpecifiedParameters["Name"]).substring(0,1))
  9.     {
  10.        "[A-F]" {$databasename = "MDB A-F"}
  11.        "[G-L]" {$databasename = "MDB G-L"}
  12.        "[M-R]" {$databasename = "MDB M-R"}
  13.        "[S-X]" {$databasename = "MDB S-X" }
  14.        "[Y-Z]" {$databasename = "MDB Y-Z" }
  15.         default {$databasename = "MDB Y-Z" }
  16.     }
  17.  
  18.  
  19. #New template recipient
  20. $user = new-object -type Microsoft.Exchange.Data.Directory.Recipient.ADUser;
  21.  
  22. #The template recipient are provided a database based on the result of the regex switch
  23. $user.database = "CN=$databasename,CN=Databases,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN="Exchange organization name",CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=domain,DC=local";
  24.  
  25. #The template recipient are provided as an argument to a new template mailbox which will be used by the New-Mailbox cmdlet
  26. new-object -type Microsoft.Exchange.Data.Directory.Management.Mailbox -argumentlist $user
  27.  
  28.   </ApiCall>
  29.  </Feature>
  30.  
  31. </Configuration>

Submit a correction or amendment below (
click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:


Remember me