{"id":179,"date":"2018-05-07T16:37:57","date_gmt":"2018-05-07T16:37:57","guid":{"rendered":"http:\/\/107.181.191.134\/?p=179"},"modified":"2021-06-12T16:10:31","modified_gmt":"2021-06-12T16:10:31","slug":"powershell-ad-administrator-adding-a-new-user","status":"publish","type":"post","link":"https:\/\/certcent.io\/index.php\/2018\/05\/07\/powershell-ad-administrator-adding-a-new-user\/","title":{"rendered":"Powershell AD administrator &#8211; adding a new user."},"content":{"rendered":"<p>Adding, removing, or modifying AD users are the most common tasks of any Windows administrator. Having a well defined Powershell script makes this job much easier and consistent.<br \/>\nOkay, users my rough version of the new user:<br \/>\n# Description: Creates a new AD user in OU=Office Users,OU=Everett<br \/>\nUsers,DC=Corp,DC=local Takes the like user and adds new user groups.<br \/>\nConverts plain text password to secure password.<br \/>\n#<br \/>\n# Created: 7-16-2018<br \/>\nwrite-host &#8220;Enter username&#8221;<br \/>\nread-host username<br \/>\nwrite-host &#8220;Enter Full Name&#8221;<br \/>\nread-host fullname<br \/>\nwrite-host &#8220;Enter password&#8221;<br \/>\nread-host password<br \/>\nwrite-host &#8220;Like user&#8221;<br \/>\nread-host likeuser<br \/>\n$newpassword = ConvertTo-SecureString $password -asplaintext -force<br \/>\n$groups = get-aduser $likeuser -properties memberof | select memberof<br \/>\n-expandproperties<br \/>\n$path = &#8220;OU=Office Users,OU=company Users,DC=company,DC=local&#8221;<br \/>\nnew-aduser -samaccountname $username -path $path -Name $name &#8211;<br \/>\naccountpassword $newpassword<br \/>\nforeach ($i in $groups)<br \/>\n{ Add-AdGroupMember $i -members $username }<br \/>\nAnother version on the web:<br \/>\nhttps:\/\/www.toddklindt.com\/blog\/Lists\/Posts\/Post.aspx?ID=362<br \/>\nA newer version that has a very good explanation:<br \/>\nhttps:\/\/4sysops.com\/archives\/create-new-active-directory-users-with-a-powershell-script\/<br \/>\nMore to come&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Adding, removing, or modifying AD users are the most common tasks of any Windows administrator. Having a well defined Powershell script makes this job much easier and consistent. Okay, users my rough version of the new user: # Description: Creates a new AD user in OU=Office Users,OU=Everett Users,DC=Corp,DC=local Takes the like user and adds new&hellip; <a class=\"more-link\" href=\"https:\/\/certcent.io\/index.php\/2018\/05\/07\/powershell-ad-administrator-adding-a-new-user\/\">Continue reading <span class=\"screen-reader-text\">Powershell AD administrator &#8211; adding a new user.<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/certcent.io\/index.php\/wp-json\/wp\/v2\/posts\/179"}],"collection":[{"href":"https:\/\/certcent.io\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/certcent.io\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/certcent.io\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/certcent.io\/index.php\/wp-json\/wp\/v2\/comments?post=179"}],"version-history":[{"count":1,"href":"https:\/\/certcent.io\/index.php\/wp-json\/wp\/v2\/posts\/179\/revisions"}],"predecessor-version":[{"id":447,"href":"https:\/\/certcent.io\/index.php\/wp-json\/wp\/v2\/posts\/179\/revisions\/447"}],"wp:attachment":[{"href":"https:\/\/certcent.io\/index.php\/wp-json\/wp\/v2\/media?parent=179"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/certcent.io\/index.php\/wp-json\/wp\/v2\/categories?post=179"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/certcent.io\/index.php\/wp-json\/wp\/v2\/tags?post=179"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}