{"id":592,"date":"2021-09-30T16:05:50","date_gmt":"2021-09-30T12:05:50","guid":{"rendered":"https:\/\/www.buildingtheitguy.com\/\/?p=592"},"modified":"2023-07-23T08:30:00","modified_gmt":"2023-07-23T04:30:00","slug":"how-to-create-new-account-with-powershell-on-windows","status":"publish","type":"post","link":"https:\/\/www.buildingtheitguy.com\/index.php\/how-to-create-new-account-with-powershell-on-windows\/it-automation\/","title":{"rendered":"How to create new account with PowerShell on Windows"},"content":{"rendered":"\n<p><span style=\"font-family: Verdana, Geneva, sans-serif; font-size: 12px;\">An easy way to create windows admin users with script, which could help IT professionals doing boring jobs to automation.<\/span><span style=\"font-family: Verdana, Geneva, sans-serif; font-size: 12px;\"><span style=\"font-size: 12px;\">\nRun PowerShell and copy paste below code. BOOM you have created local account with admin access.&nbsp;<\/span>&nbsp;<\/span><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: powershell; gutter: false; title: ; notranslate\" title=\"\">\n$Username = &quot;BuildingTHEITGUY&quot;\n$Password = &quot;Yourpassword123456&quot;\n$group = &quot;Administrators&quot;\n$adsi = &#x5B;ADSI]&quot;WinNT:\/\/$env:COMPUTERNAME&quot;\n$existing = $adsi.Children | where {$_.SchemaClassName -eq 'user' -and $_.Name -eq $Username }\nif ($existing -eq $null) {\n   Write-Host &quot;Creating new local user $Username.&quot;\n   &amp; NET USER $Username $Password \/add \/y \/expires:never\n   \n   Write-Host &quot;Adding local user $Username to $group.&quot;\n   &amp; NET LOCALGROUP $group $Username \/add\n}\nelse {\n   Write-Host &quot;Setting password for existing local user $Username.&quot;\n   $existing.SetPassword($Password)\n}\nWrite-Host &quot;Ensuring password for $Username never expires.&quot;\n&amp; WMIC USERACCOUNT WHERE &quot;Name='$Username'&quot; SET PasswordExpires=FALSE\n<\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>Create new account with PowerShell on Windows<\/p>\n","protected":false},"author":1,"featured_media":596,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[95],"tags":[],"class_list":["post-592","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-it-automation"],"featured_image_src":"https:\/\/www.buildingtheitguy.com\/wp-content\/uploads\/2021\/09\/How-to-create-new-account-with-PowerShell-on-Windows.gif","author_info":{"display_name":"Mohamed Asath","author_link":"https:\/\/www.buildingtheitguy.com\/index.php\/author\/asathwebtieradmin\/"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to create new account with PowerShell on Windows - Building THE IT GUY<\/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:\/\/www.buildingtheitguy.com\/index.php\/how-to-create-new-account-with-powershell-on-windows\/it-automation\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to create new account with PowerShell on Windows - Building THE IT GUY\" \/>\n<meta property=\"og:description\" content=\"Create new account with PowerShell on Windows\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.buildingtheitguy.com\/index.php\/how-to-create-new-account-with-powershell-on-windows\/it-automation\/\" \/>\n<meta property=\"og:site_name\" content=\"Building THE IT GUY\" \/>\n<meta property=\"article:published_time\" content=\"2021-09-30T12:05:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-07-23T04:30:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.buildingtheitguy.com\/wp-content\/uploads\/2021\/09\/How-to-create-new-account-with-PowerShell-on-Windows.gif\" \/>\n\t<meta property=\"og:image:width\" content=\"580\" \/>\n\t<meta property=\"og:image:height\" content=\"380\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/gif\" \/>\n<meta name=\"author\" content=\"Mohamed Asath\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mohamed Asath\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. 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\":\"Article\",\"@id\":\"https:\\\/\\\/www.buildingtheitguy.com\\\/index.php\\\/how-to-create-new-account-with-powershell-on-windows\\\/it-automation\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.buildingtheitguy.com\\\/index.php\\\/how-to-create-new-account-with-powershell-on-windows\\\/it-automation\\\/\"},\"author\":{\"name\":\"Mohamed Asath\",\"@id\":\"https:\\\/\\\/www.buildingtheitguy.com\\\/#\\\/schema\\\/person\\\/cce03fcda4c40ccf57ab3844ca707561\"},\"headline\":\"How to create new account with PowerShell on Windows\",\"datePublished\":\"2021-09-30T12:05:50+00:00\",\"dateModified\":\"2023-07-23T04:30:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.buildingtheitguy.com\\\/index.php\\\/how-to-create-new-account-with-powershell-on-windows\\\/it-automation\\\/\"},\"wordCount\":47,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.buildingtheitguy.com\\\/index.php\\\/how-to-create-new-account-with-powershell-on-windows\\\/it-automation\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.buildingtheitguy.com\\\/wp-content\\\/uploads\\\/2021\\\/09\\\/How-to-create-new-account-with-PowerShell-on-Windows.gif\",\"articleSection\":[\"IT Automation\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.buildingtheitguy.com\\\/index.php\\\/how-to-create-new-account-with-powershell-on-windows\\\/it-automation\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.buildingtheitguy.com\\\/index.php\\\/how-to-create-new-account-with-powershell-on-windows\\\/it-automation\\\/\",\"url\":\"https:\\\/\\\/www.buildingtheitguy.com\\\/index.php\\\/how-to-create-new-account-with-powershell-on-windows\\\/it-automation\\\/\",\"name\":\"How to create new account with PowerShell on Windows - Building THE IT GUY\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.buildingtheitguy.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.buildingtheitguy.com\\\/index.php\\\/how-to-create-new-account-with-powershell-on-windows\\\/it-automation\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.buildingtheitguy.com\\\/index.php\\\/how-to-create-new-account-with-powershell-on-windows\\\/it-automation\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.buildingtheitguy.com\\\/wp-content\\\/uploads\\\/2021\\\/09\\\/How-to-create-new-account-with-PowerShell-on-Windows.gif\",\"datePublished\":\"2021-09-30T12:05:50+00:00\",\"dateModified\":\"2023-07-23T04:30:00+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.buildingtheitguy.com\\\/#\\\/schema\\\/person\\\/cce03fcda4c40ccf57ab3844ca707561\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.buildingtheitguy.com\\\/index.php\\\/how-to-create-new-account-with-powershell-on-windows\\\/it-automation\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.buildingtheitguy.com\\\/index.php\\\/how-to-create-new-account-with-powershell-on-windows\\\/it-automation\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.buildingtheitguy.com\\\/index.php\\\/how-to-create-new-account-with-powershell-on-windows\\\/it-automation\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.buildingtheitguy.com\\\/wp-content\\\/uploads\\\/2021\\\/09\\\/How-to-create-new-account-with-PowerShell-on-Windows.gif\",\"contentUrl\":\"https:\\\/\\\/www.buildingtheitguy.com\\\/wp-content\\\/uploads\\\/2021\\\/09\\\/How-to-create-new-account-with-PowerShell-on-Windows.gif\",\"width\":580,\"height\":380,\"caption\":\"creating windows user account usiing powershell\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.buildingtheitguy.com\\\/index.php\\\/how-to-create-new-account-with-powershell-on-windows\\\/it-automation\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.buildingtheitguy.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to create new account with PowerShell on Windows\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.buildingtheitguy.com\\\/#website\",\"url\":\"https:\\\/\\\/www.buildingtheitguy.com\\\/\",\"name\":\"Building THE IT GUY\",\"description\":\"Making Everyone&#039;s Life Easier\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.buildingtheitguy.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.buildingtheitguy.com\\\/#\\\/schema\\\/person\\\/cce03fcda4c40ccf57ab3844ca707561\",\"name\":\"Mohamed Asath\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ab17cc6285a5051affe4181f53011c89cc055de9416bcc44b3e2771be318d870?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ab17cc6285a5051affe4181f53011c89cc055de9416bcc44b3e2771be318d870?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ab17cc6285a5051affe4181f53011c89cc055de9416bcc44b3e2771be318d870?s=96&r=g\",\"caption\":\"Mohamed Asath\"},\"description\":\"Turning IT Challenges into Opportunities\",\"sameAs\":[\"https:\\\/\\\/www.buildingtheitguy.com\"],\"url\":\"https:\\\/\\\/www.buildingtheitguy.com\\\/index.php\\\/author\\\/asathwebtieradmin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to create new account with PowerShell on Windows - Building THE IT GUY","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:\/\/www.buildingtheitguy.com\/index.php\/how-to-create-new-account-with-powershell-on-windows\/it-automation\/","og_locale":"en_US","og_type":"article","og_title":"How to create new account with PowerShell on Windows - Building THE IT GUY","og_description":"Create new account with PowerShell on Windows","og_url":"https:\/\/www.buildingtheitguy.com\/index.php\/how-to-create-new-account-with-powershell-on-windows\/it-automation\/","og_site_name":"Building THE IT GUY","article_published_time":"2021-09-30T12:05:50+00:00","article_modified_time":"2023-07-23T04:30:00+00:00","og_image":[{"width":580,"height":380,"url":"https:\/\/www.buildingtheitguy.com\/wp-content\/uploads\/2021\/09\/How-to-create-new-account-with-PowerShell-on-Windows.gif","type":"image\/gif"}],"author":"Mohamed Asath","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Mohamed Asath","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.buildingtheitguy.com\/index.php\/how-to-create-new-account-with-powershell-on-windows\/it-automation\/#article","isPartOf":{"@id":"https:\/\/www.buildingtheitguy.com\/index.php\/how-to-create-new-account-with-powershell-on-windows\/it-automation\/"},"author":{"name":"Mohamed Asath","@id":"https:\/\/www.buildingtheitguy.com\/#\/schema\/person\/cce03fcda4c40ccf57ab3844ca707561"},"headline":"How to create new account with PowerShell on Windows","datePublished":"2021-09-30T12:05:50+00:00","dateModified":"2023-07-23T04:30:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.buildingtheitguy.com\/index.php\/how-to-create-new-account-with-powershell-on-windows\/it-automation\/"},"wordCount":47,"commentCount":0,"image":{"@id":"https:\/\/www.buildingtheitguy.com\/index.php\/how-to-create-new-account-with-powershell-on-windows\/it-automation\/#primaryimage"},"thumbnailUrl":"https:\/\/www.buildingtheitguy.com\/wp-content\/uploads\/2021\/09\/How-to-create-new-account-with-PowerShell-on-Windows.gif","articleSection":["IT Automation"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.buildingtheitguy.com\/index.php\/how-to-create-new-account-with-powershell-on-windows\/it-automation\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.buildingtheitguy.com\/index.php\/how-to-create-new-account-with-powershell-on-windows\/it-automation\/","url":"https:\/\/www.buildingtheitguy.com\/index.php\/how-to-create-new-account-with-powershell-on-windows\/it-automation\/","name":"How to create new account with PowerShell on Windows - Building THE IT GUY","isPartOf":{"@id":"https:\/\/www.buildingtheitguy.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.buildingtheitguy.com\/index.php\/how-to-create-new-account-with-powershell-on-windows\/it-automation\/#primaryimage"},"image":{"@id":"https:\/\/www.buildingtheitguy.com\/index.php\/how-to-create-new-account-with-powershell-on-windows\/it-automation\/#primaryimage"},"thumbnailUrl":"https:\/\/www.buildingtheitguy.com\/wp-content\/uploads\/2021\/09\/How-to-create-new-account-with-PowerShell-on-Windows.gif","datePublished":"2021-09-30T12:05:50+00:00","dateModified":"2023-07-23T04:30:00+00:00","author":{"@id":"https:\/\/www.buildingtheitguy.com\/#\/schema\/person\/cce03fcda4c40ccf57ab3844ca707561"},"breadcrumb":{"@id":"https:\/\/www.buildingtheitguy.com\/index.php\/how-to-create-new-account-with-powershell-on-windows\/it-automation\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.buildingtheitguy.com\/index.php\/how-to-create-new-account-with-powershell-on-windows\/it-automation\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.buildingtheitguy.com\/index.php\/how-to-create-new-account-with-powershell-on-windows\/it-automation\/#primaryimage","url":"https:\/\/www.buildingtheitguy.com\/wp-content\/uploads\/2021\/09\/How-to-create-new-account-with-PowerShell-on-Windows.gif","contentUrl":"https:\/\/www.buildingtheitguy.com\/wp-content\/uploads\/2021\/09\/How-to-create-new-account-with-PowerShell-on-Windows.gif","width":580,"height":380,"caption":"creating windows user account usiing powershell"},{"@type":"BreadcrumbList","@id":"https:\/\/www.buildingtheitguy.com\/index.php\/how-to-create-new-account-with-powershell-on-windows\/it-automation\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.buildingtheitguy.com\/"},{"@type":"ListItem","position":2,"name":"How to create new account with PowerShell on Windows"}]},{"@type":"WebSite","@id":"https:\/\/www.buildingtheitguy.com\/#website","url":"https:\/\/www.buildingtheitguy.com\/","name":"Building THE IT GUY","description":"Making Everyone&#039;s Life Easier","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.buildingtheitguy.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.buildingtheitguy.com\/#\/schema\/person\/cce03fcda4c40ccf57ab3844ca707561","name":"Mohamed Asath","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/ab17cc6285a5051affe4181f53011c89cc055de9416bcc44b3e2771be318d870?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/ab17cc6285a5051affe4181f53011c89cc055de9416bcc44b3e2771be318d870?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ab17cc6285a5051affe4181f53011c89cc055de9416bcc44b3e2771be318d870?s=96&r=g","caption":"Mohamed Asath"},"description":"Turning IT Challenges into Opportunities","sameAs":["https:\/\/www.buildingtheitguy.com"],"url":"https:\/\/www.buildingtheitguy.com\/index.php\/author\/asathwebtieradmin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.buildingtheitguy.com\/index.php\/wp-json\/wp\/v2\/posts\/592","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.buildingtheitguy.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.buildingtheitguy.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.buildingtheitguy.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.buildingtheitguy.com\/index.php\/wp-json\/wp\/v2\/comments?post=592"}],"version-history":[{"count":9,"href":"https:\/\/www.buildingtheitguy.com\/index.php\/wp-json\/wp\/v2\/posts\/592\/revisions"}],"predecessor-version":[{"id":602,"href":"https:\/\/www.buildingtheitguy.com\/index.php\/wp-json\/wp\/v2\/posts\/592\/revisions\/602"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.buildingtheitguy.com\/index.php\/wp-json\/wp\/v2\/media\/596"}],"wp:attachment":[{"href":"https:\/\/www.buildingtheitguy.com\/index.php\/wp-json\/wp\/v2\/media?parent=592"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.buildingtheitguy.com\/index.php\/wp-json\/wp\/v2\/categories?post=592"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.buildingtheitguy.com\/index.php\/wp-json\/wp\/v2\/tags?post=592"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}