{"id":2025,"date":"2011-01-07T01:14:36","date_gmt":"2011-01-07T00:14:36","guid":{"rendered":"http:\/\/contoso.se\/blog\/?p=2025"},"modified":"2011-01-07T01:14:36","modified_gmt":"2011-01-07T00:14:36","slug":"generate-demo-objects-with-opalis","status":"publish","type":"post","link":"http:\/\/contoso.se\/blog\/?p=2025","title":{"rendered":"Generate demo objects with Opalis"},"content":{"rendered":"<p>I often build new sandboxes and test environments for different reasons. One common scenario with all these lab environments is that I never have any data in it for\u00c2\u00a0example in Active Directory, in databases, in Service Manager CMDB or in Exchange mailboxes. I have solved this with a number of Opalis workflows. For example I have one to generates a lot of data in a Service Manager CMDB, one to generate mail traffic and then one for Active Directory.<\/p>\n<p>The Active Directory policy is actually three policies. It is one for creating AD users, one for creating AD computers and one for generate common data to the two other policies.<\/p>\n<p>When you are building larger and complex policies it is a good practice to break it down to smaller parts. You can then also call the different parts from different policies and re-use your policies in different scenarios. In this example I have a policy to generate the location data for both users and workstations. Instead of build the same functionality in two policies I have one, which the other two is using. Another thing is to configure the working path green, it gives you a good overview how you want the policy to work. Red links\u00c2\u00a0can be failure or fail-over, path that your policy takes when something didn\u00e2\u20ac\u2122t turn out the way you were hoping.<\/p>\n<p>I tried to put all info that I will change often in variables, for example domain name, AD paths and number of AD objects I want to generate. It is much easier to change one variable and then configure 10 objects to use it then changing 10 objects in the policy each time I copy the policy to a new environment.<\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/01\/OpalisAD01.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-2026  aligncenter\" title=\"OpalisAD01\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/01\/OpalisAD01-300x198.jpg\" alt=\"\" width=\"300\" height=\"198\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/01\/OpalisAD01-300x198.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/01\/OpalisAD01.jpg 858w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/01\/OpalisAD07.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-2044  aligncenter\" title=\"OpalisAD07\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/01\/OpalisAD07-300x192.jpg\" alt=\"\" width=\"300\" height=\"192\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/01\/OpalisAD07-300x192.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/01\/OpalisAD07.jpg 773w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>The 1.1 policy (users) and the 1.2 (workstations) policies works almost the same<\/p>\n<ol>\n<li>Starts with a custom start<\/li>\n<li>Reset a counter to 0. This counter will be used to count number of objects we create<\/li>\n<li>Generates a four digits random number that will be used as employment number for users and\u00c2\u00a0single copy for workstations. We will also use the first digit here to set the department of the user object<\/li>\n<li>\u00c2\u00a0Trigger the 1.3 policy and then waits until it is done. The 1.3 policy will generate a location and a short name for the location. We use this as for example location and\u00c2\u00a0office\u00c2\u00a0for user objects and in the name of workstations\n<p style=\"text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter\" title=\"OpalisAD02\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/01\/OpalisAD02-300x256.jpg\" alt=\"\" width=\"300\" height=\"256\" \/><\/p>\n<\/li>\n<li>Generate a two digits random numbers that will be used to map\u00c2\u00a0first name<\/li>\n<li>Generate a two digits random number that will be used to map\u00c2\u00a0last name<\/li>\n<li>Map first name, last name and department. I have used a list that I found on the Internet with top 100 first names\u00c2\u00a0and top 100 last names. Think it was a Swedish list. Random numbers generated will be mapped to a first name and a last name. We will use the first digit of the 4 digits random number to set the department of the user.\n<p style=\"text-align: center;\"><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/01\/OpalisAD03.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-2033  aligncenter\" title=\"OpalisAD03\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/01\/OpalisAD03-300x197.jpg\" alt=\"\" width=\"300\" height=\"197\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/01\/OpalisAD03-300x197.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/01\/OpalisAD03.jpg 830w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<\/li>\n<li>Next step creates the user object. As you can see we re-use a lot of the digits that we have generated, for example to set phone, postalCode and\u00c2\u00a0MobilePhone. We use the first name and last name in different combinations and also the variables set under global settings in Opalis. Total of 16 attributes will be configured for each user object.<\/li>\n<li>Next\u00c2\u00a0step enables the user account in Active Directory<\/li>\n<li>Set the counter value to +1. We reset the counter in the beginning\u00c2\u00a0to 0 and for each created object we add one (+1) to the value<\/li>\n<li>We compare the counter value with the target value. The target value is set by a variable. If we dont have enough objects we will follow the orange link and create more, else we will follow the green link and generate a platform event saying the policy is done.<\/li>\n<\/ol>\n<p style=\"text-align: center;\"><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/01\/OpalisAD04.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-2034  aligncenter\" title=\"OpalisAD04\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/01\/OpalisAD04-300x123.jpg\" alt=\"\" width=\"300\" height=\"123\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/01\/OpalisAD04-300x123.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/01\/OpalisAD04.jpg 674w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/01\/OpalisAD05.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-2035  aligncenter\" title=\"OpalisAD05\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/01\/OpalisAD05-300x202.jpg\" alt=\"\" width=\"300\" height=\"202\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/01\/OpalisAD05-300x202.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/01\/OpalisAD05.jpg 922w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>There are a number of variables that you need to configure before you use the policy.<\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/01\/OpalisAD06.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-2036  aligncenter\" title=\"OpalisAD06\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/01\/OpalisAD06-300x103.jpg\" alt=\"\" width=\"300\" height=\"103\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/01\/OpalisAD06-300x103.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/01\/OpalisAD06.jpg 986w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>As you see in the policy there is a lot of random data. For user objects there are 100 first names, 100 last names, 10 locations and a 4 digits number used in a number of ways. That would give us more than\u00c2\u00a0100,000\u00c2\u00a0different user combinations. You can download the policy here,\u00c2\u00a0<a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/01\/1.-Demo-Data.zip\">1. Demo Data<\/a>. Please note that this is provided &#8220;as is&#8221; with no warranties at all<strong>.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I often build new sandboxes and test environments for different reasons. One common scenario with all these lab environments is that I never have any data in it for\u00c2\u00a0example in Active Directory, in databases, in Service Manager CMDB or in Exchange mailboxes. I have solved this with a number of Opalis workflows. For example I &hellip; <a href=\"http:\/\/contoso.se\/blog\/?p=2025\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[58],"tags":[],"_links":{"self":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2025"}],"collection":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2025"}],"version-history":[{"count":15,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2025\/revisions"}],"predecessor-version":[{"id":2048,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2025\/revisions\/2048"}],"wp:attachment":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2025"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2025"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2025"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}