{"id":5657,"date":"2018-10-10T16:32:14","date_gmt":"2018-10-10T13:32:14","guid":{"rendered":"https:\/\/msbro.ru\/?p=5657"},"modified":"2018-10-10T16:35:08","modified_gmt":"2018-10-10T13:35:08","slug":"massovoe-sozdanie-polzovatelejj-domena-active-directory-v-testovojj-srede","status":"publish","type":"post","link":"https:\/\/msbro.ru\/index.php\/archives\/5657","title":{"rendered":"\u041c\u0430\u0441\u0441\u043e\u0432\u043e\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0434\u043e\u043c\u0435\u043d\u0430 Active Directory \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0441\u0440\u0435\u0434\u0435"},"content":{"rendered":"<p>\u041f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0441\u0440\u0435\u0434\u0435. \u0412\u0440\u0443\u0447\u043d\u0443\u044e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0431\u044b\u043b\u043e \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0431\u043e\u043b\u0435\u0435 \u0441\u043e\u0442\u043d\u0438 \u0438 \u0442\u0440\u0443\u0434\u043e\u0437\u0430\u0442\u0440\u0430\u0442\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0441\u0447\u0438\u0441\u043b\u044f\u044e\u0442\u0441\u044f \u0447\u0430\u0441\u0430\u043c\u0438.\u00a0 \u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u0447\u0438\u0442\u0430\u0432 google \u043d\u0430 \u0442\u0435\u043c\u0443 &#8220;bulk create users active directory powershell&#8221; \u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b \u0437\u0430\u0434\u0430\u0447\u0443 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043c \u043d\u0430 PowerShell.<\/p>\n<p>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<ol>\n<li>\u0418\u043c\u0435\u044e\u0442 \u0438\u043c\u0435\u043d\u0430 &#8220;Demo101&#8230;Demo599&#8221;<\/li>\n<li>\u0418\u043c\u0435\u044e\u0442 \u043f\u0440\u0435\u0434\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c &#8220;Passw0rd!&#8221;<\/li>\n<li>\u0418\u043c\u0435\u044e\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u0430\u043a &#8220;demo \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c&#8221;<\/li>\n<li>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430 \u0434\u043e\u043c\u0430\u0448\u043d\u044f\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f &#8220;\\\\dc01\\DemoPF$&#8221; \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0430\u044f \u043a\u0430\u043a \u0434\u0438\u0441\u043a &#8221; H&#8221;(\u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f \u043e\u0434\u043d\u0430 \u0434\u043b\u044f \u0432\u0441\u0435\u0445!!!)<\/li>\n<li>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u043f\u0443\u0442\u044c \u043f\u0440\u043e\u0444\u0438\u043b\u044f &#8220;c:\\Users\\MandatoryUser&#8221;<\/li>\n<li>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d \u0437\u0430\u0445\u043e\u0434 (logon) \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c &#8220;terminal&#8221;<\/li>\n<li>\u041f\u0440\u0438 \u0432\u0445\u043e\u0434\u0435 \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 (&#8216;&#8221;C:\\Program Files\\Microsoft Office\\Office15\\EXCEL.EXE&#8221; X:\\excel.xlsx&#8217;)<\/li>\n<li>\u041f\u0440\u0438 \u0432\u0445\u043e\u0434\u0435 \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0447\u0430\u044f \u043f\u0430\u043f\u043a\u0430\u00a0&#8220;%temp%&#8221;<\/li>\n<li>\u041f\u0440\u0438 \u0432\u0445\u043e\u0434\u0435 \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u0434\u0438\u0441\u043a\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 (ConnectClientDrivesAtLogon&#8221;,0)<\/li>\n<li>\u041f\u0440\u0438 \u0432\u0445\u043e\u0434\u0435 \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438\u043d\u0442\u0435\u0440\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0430(&#8220;ConnectClientPrintersAtLogon&#8221;,0)<\/li>\n<li>\u041f\u0440\u0438 \u0432\u0445\u043e\u0434\u0435 \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043f\u0440\u0438\u043d\u0442\u0435\u0440 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 (&#8220;DefaultToMainPrinter&#8221;,0)<\/li>\n<\/ol>\n<p><!--more--><\/p>\n<p>\u0421\u0430\u043c \u0441\u043a\u0440\u0438\u043f\u0442:<\/p>\n<pre>cls\r\n$org = \"OU=TestUser,OU=_OU-Users,OU=_OU-Test,DC=newdomain,DC=local\"\r\n$username = \"Demo\"\r\n$count = 101..599\r\nforeach ($i in $count)\r\n{ New-AdUser -Name $username$i -Path $org -Enabled $True -ChangePasswordAtLogon $false -AccountPassword (ConvertTo-SecureString \"Passw0rd!\" -AsPlainText -force) -passThru \r\n\r\n$user = \"$username\" + \"$i\"\r\n$varUPN = $user + '@newdomain.local'\r\n$varName1 = \"$username\"\r\n$varname2 = \"$i\"\r\n$varName3 = $varName1 + ' ' + $varname2\r\nSet-ADUser -Identity $user -Replace @{samaccountname=$user}\r\nSet-ADUser -Identity $user -GivenName $varName1 -Surname $varname2 -DisplayName $varName3 -UserPrincipalName $varUPN -Description \"demo \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\"\r\nSet-ADUser -Identity $User -CannotChangePassword $True -PasswordNeverExpires $True\r\nSet-ADUser -Identity $User -HomeDrive \"X:\" -HomeDirectory \"\\\\dc01\\DemoPF$\" -ProfilePath \"c:\\Users\\MandatoryUser\"\r\nSet-ADUser -Identity $User -LogonWorkstations \"terminal\" \r\n$dn  = (Get-ADUser $user).DistinguishedName \r\n$ext = [ADSI]\"LDAP:\/\/$dn\" \r\n$ext.PSBase.InvokeSet(\"TerminalServicesInitialProgram\",'\"C:\\Program Files\\Microsoft Office\\Office15\\EXCEL.EXE\" X:\\excel.xlsx')\r\n$ext.PSBase.InvokeSet(\"TerminalServicesWorkDirectory\",\"%temp%\")\r\n$ext.PSBase.InvokeSet(\"ConnectClientDrivesAtLogon\",0)\r\n$ext.PSBase.InvokeSet(\"ConnectClientPrintersAtLogon\",0)\r\n$ext.PSBase.InvokeSet(\"DefaultToMainPrinter\",0) \r\n$ext.SetInfo()\r\n}\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u041f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0441\u0440\u0435\u0434\u0435. \u0412\u0440\u0443\u0447\u043d\u0443\u044e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0431\u044b\u043b\u043e \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0431\u043e\u043b\u0435\u0435 \u0441\u043e\u0442\u043d\u0438 \u0438 \u0442\u0440\u0443\u0434\u043e\u0437\u0430\u0442\u0440\u0430\u0442\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0441\u0447\u0438\u0441\u043b\u044f\u044e\u0442\u0441\u044f \u0447\u0430\u0441\u0430\u043c\u0438.\u00a0 \u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u0447\u0438\u0442\u0430\u0432 google \u043d\u0430 \u0442\u0435\u043c\u0443 &#8220;bulk create users active directory powershell&#8221; \u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b \u0437\u0430\u0434\u0430\u0447\u0443 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043c \u043d\u0430 PowerShell. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: \u0418\u043c\u0435\u044e\u0442 \u0438\u043c\u0435\u043d\u0430 &#8220;Demo101&#8230;Demo599&#8221; \u0418\u043c\u0435\u044e\u0442 \u043f\u0440\u0435\u0434\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c &#8220;Passw0rd!&#8221; &#8230;<\/p>\n<p><a href=\"https:\/\/msbro.ru\/index.php\/archives\/5657\" class=\"more-link\">Continue reading &lsquo;\u041c\u0430\u0441\u0441\u043e\u0432\u043e\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0434\u043e\u043c\u0435\u043d\u0430 Active Directory \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0441\u0440\u0435\u0434\u0435&rsquo; &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[182,1865,1863,1869,1870,1864,1871,1867,1873,1868,17,1872,1838,1744,1866,43],"class_list":["post-5657","post","type-post","status-publish","format-standard","hentry","category-scripts","tag-active-directory","tag-bulk","tag-bulk-create-users","tag-connectclientdrivesatlogon","tag-connectclientprintersatlogon","tag-create-users","tag-defaulttomainprinter","tag-demo","tag-invokeset","tag-mandatoryuser","tag-powershell","tag-psbase","tag-script","tag-terminal","tag-test-users","tag-users"],"_links":{"self":[{"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/posts\/5657"}],"collection":[{"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/comments?post=5657"}],"version-history":[{"count":2,"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/posts\/5657\/revisions"}],"predecessor-version":[{"id":5660,"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/posts\/5657\/revisions\/5660"}],"wp:attachment":[{"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/media?parent=5657"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/categories?post=5657"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/tags?post=5657"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}<!-- WP Super Cache is installed but broken. The constant WPCACHEHOME must be set in the file wp-config.php and point at the WP Super Cache plugin directory. -->