{"id":2008,"date":"2019-08-13T14:34:08","date_gmt":"2019-08-13T13:34:08","guid":{"rendered":"https:\/\/hypervlab.co.uk\/?p=2008"},"modified":"2019-08-13T15:17:40","modified_gmt":"2019-08-13T14:17:40","slug":"changing-the-active-directory-user-principal-name-on-mass","status":"publish","type":"post","link":"https:\/\/hypervlab.co.uk\/?p=2008","title":{"rendered":"Changing the Active Directory User Principal Name on Mass"},"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\"> &lt; 1<\/span> <span class=\"rt-label rt-postfix\">minute<\/span><\/span>\n<p>In the <a href=\"https:\/\/hypervlab.co.uk\/2019\/08\/configure-an-alternative-active-directory-user-principal-name\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"previous blog post (opens in a new tab)\">previous blog post<\/a>, I covered how to configure an additional User Principal Name for the ad.hypervlab.co.uk. Now we need to change the UPN for the 100 Users within the company so they can be synced with the Microsoft O365 Email Provision that the HypervLAB Company utilises.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Import Powershell Modules\nImport-Module -Name 'ActiveDirectory'\n\n# Script Variables\n$LocalUPN = (Get-ADForest).RootDomain\n$FQDNUPN  = (Get-ADForest).UPNSuffixes\n$StagingOU = 'OU=TestOU,OU=User Accounts,OU=HypervLAB,DC=ad,DC=hypervlab,DC=co,DC=uk'\n$QueryUser = Get-ADUser -Filter * -SearchBase $StagingOU\n\n# Configure Users\nForEach ($User in $QueryUser) {\n\n $NewUPN = \"$($User.SamAccountName)\" + \"@\" + \"$FQDNUPN\"\n Get-ADUser $User | Set-ADUser -UserPrincipalName $NewUPN -Verbose\n \n}<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1208\" height=\"623\" src=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2019\/08\/Pwsh-UPNUpdate.gif\" alt=\"\" class=\"wp-image-2009\"\/><\/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\"> &lt; 1<\/span> <span class=\"rt-label rt-postfix\">minute<\/span><\/span>In the previous blog post, I covered how to configure an additional User Principal Name for the ad.hypervlab.co.uk. Now we need to change the UPN for the 100 Users within the company so they can be synced with the Microsoft O365 Email Provision that the HypervLAB Company utilises.<\/p>\n","protected":false},"author":2,"featured_media":2011,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[69,19],"tags":[96,216,92,244,99],"class_list":["post-2008","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-active-directory","category-windows-server-2019","tag-activedirectory","tag-automation","tag-powershell","tag-userprincipalname","tag-windowsserver"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Changing the Active Directory User Principal Name on Mass - 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=2008\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Changing the Active Directory User Principal Name on Mass - HypervLAB\" \/>\n<meta property=\"og:description\" content=\"Reading Time:  &lt; 1 minuteIn the previous blog post, I covered how to configure an additional User Principal Name for the ad.hypervlab.co.uk. Now we need to change the UPN for the 100 Users within the company so they can be synced with the Microsoft O365 Email Provision that the HypervLAB Company utilises.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/hypervlab.co.uk\/?p=2008\" \/>\n<meta property=\"og:site_name\" content=\"HypervLAB\" \/>\n<meta property=\"article:published_time\" content=\"2019-08-13T13:34:08+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-08-13T14:17:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2019\/08\/FeautureImage_UPNUpdateScript.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=2008\",\"url\":\"https:\/\/hypervlab.co.uk\/?p=2008\",\"name\":\"Changing the Active Directory User Principal Name on Mass - HypervLAB\",\"isPartOf\":{\"@id\":\"https:\/\/hypervlab.co.uk\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/hypervlab.co.uk\/?p=2008#primaryimage\"},\"image\":{\"@id\":\"https:\/\/hypervlab.co.uk\/?p=2008#primaryimage\"},\"thumbnailUrl\":\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2019\/08\/FeautureImage_UPNUpdateScript.png\",\"datePublished\":\"2019-08-13T13:34:08+00:00\",\"dateModified\":\"2019-08-13T14:17:40+00:00\",\"author\":{\"@id\":\"https:\/\/hypervlab.co.uk\/#\/schema\/person\/7d184970612a9c6a5f1babb8b6b4d359\"},\"breadcrumb\":{\"@id\":\"https:\/\/hypervlab.co.uk\/?p=2008#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/hypervlab.co.uk\/?p=2008\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/hypervlab.co.uk\/?p=2008#primaryimage\",\"url\":\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2019\/08\/FeautureImage_UPNUpdateScript.png\",\"contentUrl\":\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2019\/08\/FeautureImage_UPNUpdateScript.png\",\"width\":1200,\"height\":600},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/hypervlab.co.uk\/?p=2008#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/hypervlab.co.uk\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Changing the Active Directory User Principal Name on Mass\"}]},{\"@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":"Changing the Active Directory User Principal Name on Mass - 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=2008","og_locale":"en_GB","og_type":"article","og_title":"Changing the Active Directory User Principal Name on Mass - HypervLAB","og_description":"Reading Time:  &lt; 1 minuteIn the previous blog post, I covered how to configure an additional User Principal Name for the ad.hypervlab.co.uk. Now we need to change the UPN for the 100 Users within the company so they can be synced with the Microsoft O365 Email Provision that the HypervLAB Company utilises.","og_url":"https:\/\/hypervlab.co.uk\/?p=2008","og_site_name":"HypervLAB","article_published_time":"2019-08-13T13:34:08+00:00","article_modified_time":"2019-08-13T14:17:40+00:00","og_image":[{"width":1200,"height":600,"url":"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2019\/08\/FeautureImage_UPNUpdateScript.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=2008","url":"https:\/\/hypervlab.co.uk\/?p=2008","name":"Changing the Active Directory User Principal Name on Mass - HypervLAB","isPartOf":{"@id":"https:\/\/hypervlab.co.uk\/#website"},"primaryImageOfPage":{"@id":"https:\/\/hypervlab.co.uk\/?p=2008#primaryimage"},"image":{"@id":"https:\/\/hypervlab.co.uk\/?p=2008#primaryimage"},"thumbnailUrl":"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2019\/08\/FeautureImage_UPNUpdateScript.png","datePublished":"2019-08-13T13:34:08+00:00","dateModified":"2019-08-13T14:17:40+00:00","author":{"@id":"https:\/\/hypervlab.co.uk\/#\/schema\/person\/7d184970612a9c6a5f1babb8b6b4d359"},"breadcrumb":{"@id":"https:\/\/hypervlab.co.uk\/?p=2008#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/hypervlab.co.uk\/?p=2008"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/hypervlab.co.uk\/?p=2008#primaryimage","url":"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2019\/08\/FeautureImage_UPNUpdateScript.png","contentUrl":"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2019\/08\/FeautureImage_UPNUpdateScript.png","width":1200,"height":600},{"@type":"BreadcrumbList","@id":"https:\/\/hypervlab.co.uk\/?p=2008#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/hypervlab.co.uk\/"},{"@type":"ListItem","position":2,"name":"Changing the Active Directory User Principal Name on Mass"}]},{"@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\/2008","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=2008"}],"version-history":[{"count":0,"href":"https:\/\/hypervlab.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/2008\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hypervlab.co.uk\/index.php?rest_route=\/wp\/v2\/media\/2011"}],"wp:attachment":[{"href":"https:\/\/hypervlab.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2008"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hypervlab.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2008"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hypervlab.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2008"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}