Every time I need to check something around the Exchange management pack I realize there there is not much mail traffic in my sandbox. The main reason is of course because there are no users. The result is that there is not much to look at with the management pack. I have solved this with a number of Opalis workflows. In this blogpost I will show you the solution
The Exchange Demo policy is actually six policies,
- 3.1 Internal – Create folder and file. Creates a temporary folder to store the address file in.
- 3.2 Generate address list. Export e-mail addresses from Active directory to a address file in the folder created by 3.1.
- 3.3 Generate TO and FROM addresses. Random pick a FROM and TO address from the address file
- 3.4 Send Internal Mail. The “main” policy that trigger the others, based on a interval
- 3.5 Generate subject. Generate a random subject
- 3.6 Multiple Internal mails. Used to send a fixed number of e-mails
The solution starts with 3.4 – Send Internal Mail.
This policy run based on a interval, think in my sandbox it is every 30 seconds. It first trigger policy 3.3 and then 3.5. It will wait until each of the policies are done, before it sends a e-mail and writes to a logfile. The e-mail that is sent is based on the data that policy 3.5 and 3.3 sends back on the data bus. Lets look at policy 3.2 and 3.1 first.
Policy 3.2 will first check if a temporary file exists, this file path is set by a variable. If the file exists it is deleted. The policy then list all enable users from the Active Directory, and writes each e-mail address to a temporary file. The file is created in a folder that policy 3.1 generate. These two policies only needs to be run once, or if you want to generate a new address list from your Active Directory. The address file is named CCemails.txt.
Lets move on to policy 3.3. This policy start with get number of lines in the address file that policy 3.2 generated. Depending on number of lines it will go one of two different directions from the “Compare Number of Lines” activity. The yellow part is just a reminder that I have only built the “less then 99 lines” path, so if you have more then 99 lines in your address file, make sure you build that path of the policy too. It should look the same as the one I have built, just it should generate random numbers with three digits instead of two. It is actually not really about 99, more about number of characters in the number. The result is that the first break point is 99 and next 999. Number of characters is important in the next activity because the “Generate random text” activity can generate a random number based on number of digits, not between 0 and 25, instead that will be 0 and 99 or 0 and 999.
Next we will fin these four activities. The purpose of those is to get a FROM address and a TO address from the address file generated in policy 3.2. We can use the “Generate Random Text” activity to create a number with 2 digits, but what if we only have 20 lines in the address file? That is why we also use a Compare Values activity, to see it the random number generated is equals to a line in the address text file.
- Will generate a two character long random number
- Will see if the number from step 1 is equal to a line in the address file, if it is it will continue to 3, else it will loop and go back to 1 again to generate a new number.
- Will generate a two character long random number
- Will see if the number from step 3 is equal to a line in the address file, if it is it will continue else it will loop back to 3 again to generate a new number
The last three activities will read the e-mail address used as FROM address and the line use as TO address from the address file. It will then publish the data to the data bus, and back to policy 3.4. Policy 3.4 generate two random numbers, and then maps them to a e-mail subject and a e-mail abbreviation. The result of this is then published on the data bus and used by policy 3.4
Policy 3.4 will then send a e-mail based on the SUBJECT, TO and FROM information that has been generated. It will also write to a logfile. As you can see I start policy 3.4 every 30 seconds. That is a interval you should adapt to your own environment. These policies use a number of variables that also need to be adapted to the current environment
There is one more policy, “3.6 Multiple Internal Mails”. This policy is used when you want to send a fixed number of e-mails, not based on time interval. You can configure the number of mails to send with a counter and the policy will then loop until the number is reached, for example if you want to send 150 random e-mails. The policy use the same policies to generate FROM, TO and SUBJECT as policy 3.4 do.
After some time you will see nice demo data in Operations Manager. Both performance views and reports will have data in them. I once forgot about the policy a couple of days, and the Exchange management pack started generate alerts about mail queues, mailbox stores out of space and a lot of other interesting things 🙂 The following picture is showing the Exchange message tracking tool, showing all the e-mails Opalis is sending.
You can download my policies here, ExchangeDemoMails_v2, please note that this is provided “as is†with no warranties at all. Also please read this blog post about export and import of policies.
Recent Comments