{"id":1941,"date":"2019-08-12T11:30:12","date_gmt":"2019-08-12T10:30:12","guid":{"rendered":"https:\/\/hypervlab.co.uk\/?p=1941"},"modified":"2019-08-12T15:29:32","modified_gmt":"2019-08-12T14:29:32","slug":"generating-random-username-for-poc-active-directory-environments","status":"publish","type":"post","link":"https:\/\/hypervlab.co.uk\/?p=1941","title":{"rendered":"Generating Random User Names for PoC Active Directory Environments"},"content":{"rendered":"<span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">Reading Time: <\/span> <span class=\"rt-time\"> 2<\/span> <span class=\"rt-label rt-postfix\">minutes<\/span><\/span>\n<p>In this blog post, I will cover how I create mass test accounts for my Active Directory Lab, but using real-world names, not just user01. to be able to achieve this we need to need to utilise some PowerShell and the website <a rel=\"noreferrer noopener\" href=\"https:\/\/mockaroo.com\/\">ht<\/a><a rel=\"noreferrer noopener\" aria-label=\"tps:\/\/mockaroo.com\/  (opens in a new tab)\" href=\"https:\/\/mockaroo.com\/\" target=\"_blank\">tps:\/\/mockaroo.com\/<\/a>. The reason behind this is so I can then sync my test account to my HypervLAB AzureAD Tennent and then test with some Office365 User Groups. So we need firstly we need a CSV file with a FirstName, LastName setup. this can be achieved using mockaroo, which is an online website which allows you to configure tables and rows and then generate a pretty much limitless number of users. <\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"393\" src=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2019\/08\/image-166-1024x393.png\" alt=\"\" class=\"wp-image-1942\" srcset=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2019\/08\/image-166-1024x393.png 1024w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2019\/08\/image-166-300x115.png 300w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2019\/08\/image-166-768x295.png 768w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2019\/08\/image-166.png 1489w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>mockaroo, will allow you to generate up to 1000 rows for free, which I think for any kind of lab environment would be huge! For my test ideally, I want 200 Users, Which will be broken down into 50 &#8211; Engineering, 50 Finance, 50 &#8211; Human Resources, 50 Internal IT.<\/p>\n\n\n\n<p>Sample Export of the data:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1013\" height=\"720\" src=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2019\/08\/image-167.png\" alt=\"\" class=\"wp-image-1943\" srcset=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2019\/08\/image-167.png 1013w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2019\/08\/image-167-300x213.png 300w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2019\/08\/image-167-768x546.png 768w\" sizes=\"auto, (max-width: 1013px) 100vw, 1013px\" \/><\/figure>\n\n\n\n<p>PowerShell Creation Script:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#\n# Active Directory User Import List\n# Author : Simon Lee\n# Date: August 2019 \n\n# Import PowerShell Module\nImport-Module -Name 'ActiveDirectory'\n\n# Define Csv Location\n$Csv = Import-Csv -Path C:\\Users\\administrator.hypervlab\\Desktop\\MOCK_DATA.csv\n\nForEach ( $User in $Csv ) {\n\n# Active Directory User Variables\n$DomainUPN = (Get-ADDomain).DNSRoot\n$GivenName = $User.first_name\n$ADGivenName = $GivenName.Substring(0,1)\n$LastName = $User.last_name\n$DisplayName = \"$GivenName\" + \" \" + \"$LastName\"\n$ADAccount = $ADGivenName + $LastName\n$UPNAccountID = \"$ADAccount\" + \"@\" + \"$DomainUPN\"\n$DefaultPwd = 'Password123!!' | ConvertTo-SecureString -AsPlainText -Force\n\n# PowerShell Creation Script\nNew-ADUser `\n-Enabled $true `\n-Name $DisplayName `\n-DisplayName $DisplayName `\n-GivenName $GivenName `\n-Surname $LastName `\n-SamAccountName $ADAccount `\n-UserPrincipalName $UPNAccountID `\n-Path 'OU=TestOU,OU=User Accounts,OU=HypervLAB,DC=ad,DC=hypervlab,DC=co,DC=uk' `\n-AccountPassword $DefaultPwd `\n-ChangePasswordAtLogon $true `\n-Verbose\n\n}<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1240\" height=\"632\" src=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2019\/08\/mockaroo_active_directory_impot.gif\" alt=\"\" class=\"wp-image-1944\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p><span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">Reading Time: <\/span> <span class=\"rt-time\"> 2<\/span> <span class=\"rt-label rt-postfix\">minutes<\/span><\/span>In this blog post, I will cover how I create mass test accounts for my Active Directory Lab, but using real-world names, not just user01. to be able to achieve this we need to need to utilise some PowerShell and the website https:\/\/mockaroo.com\/. The reason behind this is so I can then sync my test [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":1945,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[69,19],"tags":[98,96,216,92,243,105],"class_list":["post-1941","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-active-directory","category-windows-server-2019","tag-98","tag-activedirectory","tag-automation","tag-powershell","tag-userimport","tag-windowserver"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Generating Random User Names for PoC Active Directory Environments - HypervLAB<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/hypervlab.co.uk\/?p=1941\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Generating Random User Names for PoC Active Directory Environments - HypervLAB\" \/>\n<meta property=\"og:description\" content=\"Reading Time:  2 minutesIn this blog post, I will cover how I create mass test accounts for my Active Directory Lab, but using real-world names, not just user01. to be able to achieve this we need to need to utilise some PowerShell and the website https:\/\/mockaroo.com\/. The reason behind this is so I can then sync my test [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/hypervlab.co.uk\/?p=1941\" \/>\n<meta property=\"og:site_name\" content=\"HypervLAB\" \/>\n<meta property=\"article:published_time\" content=\"2019-08-12T10:30:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-08-12T14:29:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2019\/08\/FeatureImage_mockarooUserGeneration.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"600\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Simon Lee\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/smoon_lee\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Simon Lee\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/hypervlab.co.uk\/?p=1941\",\"url\":\"https:\/\/hypervlab.co.uk\/?p=1941\",\"name\":\"Generating Random User Names for PoC Active Directory Environments - HypervLAB\",\"isPartOf\":{\"@id\":\"https:\/\/hypervlab.co.uk\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/hypervlab.co.uk\/?p=1941#primaryimage\"},\"image\":{\"@id\":\"https:\/\/hypervlab.co.uk\/?p=1941#primaryimage\"},\"thumbnailUrl\":\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2019\/08\/FeatureImage_mockarooUserGeneration.png\",\"datePublished\":\"2019-08-12T10:30:12+00:00\",\"dateModified\":\"2019-08-12T14:29:32+00:00\",\"author\":{\"@id\":\"https:\/\/hypervlab.co.uk\/#\/schema\/person\/7d184970612a9c6a5f1babb8b6b4d359\"},\"breadcrumb\":{\"@id\":\"https:\/\/hypervlab.co.uk\/?p=1941#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/hypervlab.co.uk\/?p=1941\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/hypervlab.co.uk\/?p=1941#primaryimage\",\"url\":\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2019\/08\/FeatureImage_mockarooUserGeneration.png\",\"contentUrl\":\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2019\/08\/FeatureImage_mockarooUserGeneration.png\",\"width\":1200,\"height\":600},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/hypervlab.co.uk\/?p=1941#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/hypervlab.co.uk\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Generating Random User Names for PoC Active Directory Environments\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/hypervlab.co.uk\/#website\",\"url\":\"https:\/\/hypervlab.co.uk\/\",\"name\":\"HypervLAB\",\"description\":\"Blogging about all thing Microsoft\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/hypervlab.co.uk\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/hypervlab.co.uk\/#\/schema\/person\/7d184970612a9c6a5f1babb8b6b4d359\",\"name\":\"Simon Lee\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/hypervlab.co.uk\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/9473a3cf9c75192508eccfd9d072efab80adf04a45083e561d0e3065f681c34c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/9473a3cf9c75192508eccfd9d072efab80adf04a45083e561d0e3065f681c34c?s=96&d=mm&r=g\",\"caption\":\"Simon Lee\"},\"description\":\"Hi, I'm Simon an IT Enthusiast, PowerShell Geek, Gamer, and Sound Engineer. I've been working with in the IT Industry for around 6 years and have worked across private and public sector companies. The original idea behind \\\"hypervlab\\\" was that I required an 'RnD' environment which would allow me to be able to replicate any kind of enterprise on-premise environment which I could use for learning and testing without learning in a production environment. So in 2019, I decided to branch out and use the domain for a public facing blog to be able to contribute to the IT Community about all things Microsoft.\",\"sameAs\":[\"https:\/\/hypervlab.co.uk\",\"https:\/\/www.linkedin.com\/in\/simon-john-lee\/\",\"https:\/\/x.com\/https:\/\/twitter.com\/smoon_lee\"],\"url\":\"https:\/\/hypervlab.co.uk\/?author=2\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Generating Random User Names for PoC Active Directory Environments - HypervLAB","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/hypervlab.co.uk\/?p=1941","og_locale":"en_GB","og_type":"article","og_title":"Generating Random User Names for PoC Active Directory Environments - HypervLAB","og_description":"Reading Time:  2 minutesIn this blog post, I will cover how I create mass test accounts for my Active Directory Lab, but using real-world names, not just user01. to be able to achieve this we need to need to utilise some PowerShell and the website https:\/\/mockaroo.com\/. The reason behind this is so I can then sync my test [&hellip;]","og_url":"https:\/\/hypervlab.co.uk\/?p=1941","og_site_name":"HypervLAB","article_published_time":"2019-08-12T10:30:12+00:00","article_modified_time":"2019-08-12T14:29:32+00:00","og_image":[{"width":1200,"height":600,"url":"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2019\/08\/FeatureImage_mockarooUserGeneration.png","type":"image\/png"}],"author":"Simon Lee","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/smoon_lee","twitter_misc":{"Written by":"Simon Lee","Estimated reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/hypervlab.co.uk\/?p=1941","url":"https:\/\/hypervlab.co.uk\/?p=1941","name":"Generating Random User Names for PoC Active Directory Environments - HypervLAB","isPartOf":{"@id":"https:\/\/hypervlab.co.uk\/#website"},"primaryImageOfPage":{"@id":"https:\/\/hypervlab.co.uk\/?p=1941#primaryimage"},"image":{"@id":"https:\/\/hypervlab.co.uk\/?p=1941#primaryimage"},"thumbnailUrl":"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2019\/08\/FeatureImage_mockarooUserGeneration.png","datePublished":"2019-08-12T10:30:12+00:00","dateModified":"2019-08-12T14:29:32+00:00","author":{"@id":"https:\/\/hypervlab.co.uk\/#\/schema\/person\/7d184970612a9c6a5f1babb8b6b4d359"},"breadcrumb":{"@id":"https:\/\/hypervlab.co.uk\/?p=1941#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/hypervlab.co.uk\/?p=1941"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/hypervlab.co.uk\/?p=1941#primaryimage","url":"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2019\/08\/FeatureImage_mockarooUserGeneration.png","contentUrl":"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2019\/08\/FeatureImage_mockarooUserGeneration.png","width":1200,"height":600},{"@type":"BreadcrumbList","@id":"https:\/\/hypervlab.co.uk\/?p=1941#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/hypervlab.co.uk\/"},{"@type":"ListItem","position":2,"name":"Generating Random User Names for PoC Active Directory Environments"}]},{"@type":"WebSite","@id":"https:\/\/hypervlab.co.uk\/#website","url":"https:\/\/hypervlab.co.uk\/","name":"HypervLAB","description":"Blogging about all thing Microsoft","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/hypervlab.co.uk\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/hypervlab.co.uk\/#\/schema\/person\/7d184970612a9c6a5f1babb8b6b4d359","name":"Simon Lee","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/hypervlab.co.uk\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/9473a3cf9c75192508eccfd9d072efab80adf04a45083e561d0e3065f681c34c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9473a3cf9c75192508eccfd9d072efab80adf04a45083e561d0e3065f681c34c?s=96&d=mm&r=g","caption":"Simon Lee"},"description":"Hi, I'm Simon an IT Enthusiast, PowerShell Geek, Gamer, and Sound Engineer. I've been working with in the IT Industry for around 6 years and have worked across private and public sector companies. The original idea behind \"hypervlab\" was that I required an 'RnD' environment which would allow me to be able to replicate any kind of enterprise on-premise environment which I could use for learning and testing without learning in a production environment. So in 2019, I decided to branch out and use the domain for a public facing blog to be able to contribute to the IT Community about all things Microsoft.","sameAs":["https:\/\/hypervlab.co.uk","https:\/\/www.linkedin.com\/in\/simon-john-lee\/","https:\/\/x.com\/https:\/\/twitter.com\/smoon_lee"],"url":"https:\/\/hypervlab.co.uk\/?author=2"}]}},"_links":{"self":[{"href":"https:\/\/hypervlab.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1941","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hypervlab.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hypervlab.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hypervlab.co.uk\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hypervlab.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1941"}],"version-history":[{"count":0,"href":"https:\/\/hypervlab.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1941\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hypervlab.co.uk\/index.php?rest_route=\/wp\/v2\/media\/1945"}],"wp:attachment":[{"href":"https:\/\/hypervlab.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1941"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hypervlab.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1941"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hypervlab.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1941"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}