{"id":21,"date":"2020-08-29T17:40:00","date_gmt":"2020-08-29T10:40:00","guid":{"rendered":""},"modified":"2023-04-22T00:46:23","modified_gmt":"2023-04-21T17:46:23","slug":"%d0%ba%d0%b0%d0%ba-%d0%bf%d0%be%d0%bb%d1%83%d1%87%d0%b8%d1%82%d1%8c-%d1%81%d0%bf%d0%b8%d1%81%d0%be%d0%ba-%d0%bf%d0%be%d0%bb%d1%8c%d0%b7%d0%be%d0%b2%d0%b0%d1%82%d0%b5%d0%bb%d0%b5%d0%b9-ad-%d0%b8%d0%bc","status":"publish","type":"post","link":"https:\/\/mohn.ru\/?p=21","title":{"rendered":"\u041a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 AD \u0438\u043c\u0435\u044e\u0449\u0438\u0445 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u0430\u043f\u043a"},"content":{"rendered":"<p>\u0421\u0430\u043c\u044b\u0439 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u044d\u0442\u043e \u0432\u0437\u044f\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 PowerShell, \u043f\u043e\u0434\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u043f\u043e\u0434 \u0441\u0435\u0431\u044f \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c.<\/p>\n<div><\/div>\n<div>\u0425\u043e\u0440\u043e\u0448\u0438\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430\u0448\u0435\u043b \u0442\u0443\u0442:&nbsp;<a href=\"https:\/\/itbru.ru\/index.php\/2017\/08\/02\/powershell-sozdanie-spiska-userov\/\">https:\/\/itbru.ru\/index.php\/2017\/08\/02\/powershell-sozdanie-spiska-userov\/<\/a>.<\/div>\n<div><\/div>\n<div>\u0415\u0441\u0442\u044c \u0443 \u043d\u0435\u0433\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438:<\/div>\n<div>\n<ul style=\"text-align: left;\">\n<li>\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0438\u043c\u0435\u0435\u0442 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u0440\u0443\u043f\u043f;<\/li>\n<li>\u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443, \u043d\u043e \u0438 \u043f\u043e\u0434\u043f\u0430\u043f\u043a\u0438 \u0432 \u044d\u0442\u043e\u0439 \u043f\u0430\u043f\u043a\u0435.<\/li>\n<\/ul>\n<p><span><a name='more'><\/a><\/span><\/p>\n<div><\/div>\n<\/div>\n<div>\u0422.\u0435. \u0435\u0441\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u0430, \u0432 \u0433\u0440\u0443\u043f\u043f\u0435 \u0435\u0441\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u0433\u0440\u0443\u043f\u043f\u044b, \u0430 \u0443\u0436\u0435 \u0432 \u044d\u0442\u0438\u0445 \u043f\u043e\u0434\u0433\u0440\u0443\u043f\u043f\u0430\u0445 \u0435\u0441\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438.<\/div>\n<div>\u041c\u043d\u0435 \u043f\u043e\u0432\u0435\u0437\u043b\u043e \u0438 \u0443 \u043c\u0435\u043d\u044f \u0434\u0435\u0440\u0435\u0432\u043e \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432\u0441\u0435\u0433\u043e-\u043b\u0438\u0448\u044c \u0438\u0437 2-\u0445 \u0432\u0435\u0442\u0432\u0435\u0439. \u0422.\u0435. \u0433\u0440\u0443\u043f\u043f\u0430 &#8212; \u043f\u043e\u0434\u0433\u0440\u0443\u043f\u043f\u0430 &#8212; \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438.<\/div>\n<div><\/div>\n<div>\u0415\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0432\u0441\u0435\u0445 \u043f\u0430\u043f\u043e\u043a \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u043f\u0430\u043f\u043a\u0435, \u043d\u043e \u044d\u0442\u043e \u0437\u0430\u0439\u043c\u0435\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e.<\/div>\n<blockquote>\n<div>\n<div>#<\/div>\n<div>#\u0421\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u0434\u043e\u043c\u0435\u043d\u043d\u044b\u0445 \u0443\u0447\u0435\u0442\u043d\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u043c\u0435\u044e\u0442 \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u043f\u0430\u043f\u043a\u0443. \u0421\u043f\u0438\u0441\u043e\u043a \u0432\u044b\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f \u0432 CSV \u0444\u0430\u0439\u043b.&nbsp;<\/div>\n<div>#<\/div>\n<div>#\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u0430\u043f\u043a\u0443 \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0443\u0436\u0435\u043d \u043e\u0442\u0447\u0435\u0442<\/div>\n<div>$path = \u201cZ:FTP\u201d<\/div>\n<div>#\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 (\u043f\u043e\u0434\u043f\u0430\u043f\u043a\u0438) \u043f\u0430\u043f\u043a\u0438 \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0443\u0436\u0435\u043d \u043e\u0442\u0447\u0435\u0442, \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u043b\u044e\u0447 -Recurse \u0438 \u0442\u043e\u0433\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b \u0432\u0441\u0435 \u043f\u043e\u0434\u043f\u0430\u043f\u043a\u0438 \u0432\u0433\u0443\u0431\u044c, \u043d\u043e \u044d\u0442\u043e \u0437\u0430\u0439\u043c\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/div>\n<div>$folder_path = dir -Directory -Path $path -Force<\/div>\n<div>#\u043f\u0443\u0442\u044c \u043a\u0443\u0434\u0430 \u043a\u043b\u0430\u0442\u044c CSV<\/div>\n<div>$datafile = &#171;c:TempAccessRights.csv&#187;<\/div>\n<div>#\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u043f\u043e \u043f\u0443\u0442\u0438 $datafile<\/div>\n<div>Set-Content -Value &#8216;\u041f\u0430\u043f\u043a\u0430;\u0413\u0440\u0443\u043f\u043f\u0430;\u041f\u043e\u0434\u0433\u0440\u0443\u043f\u043f\u0430;\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c;\u041f\u0440\u0430\u0432\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430;\u0422\u0438\u043f&#8217; -Path $datafile -Encoding UTF8<\/div>\n<div>#\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u043c\u044f \u0434\u043e\u043c\u0435\u043d\u0430<\/div>\n<div>$domain = (Get-ADDomain).name.ToUpper()<\/div>\n<div>#\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043a\u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u043f\u0430\u043f\u043a\u0438<\/div>\n<div>$Acl = Get-Acl $path<\/div>\n<div>$acl = $acl.Access<\/div>\n<div>#\u041f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u0441\u0442\u0443\u043f\u0430<\/div>\n<div>foreach ($a in $acl)<\/div>\n<div>{<\/div>\n<div><span style=\"white-space: pre;\">\t<\/span>#\u0411\u0435\u0440\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u043c\u0435\u043d\u043d\u044b\u0435 \u0443\u0447\u0435\u0442\u043a\u0438<\/div>\n<div><span style=\"white-space: pre;\">\t<\/span>if ($a.IdentityReference -match $domain)<\/div>\n<div><span style=\"white-space: pre;\">\t<\/span>{<\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>#\u041f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043d\u0430 \u0447\u0435\u043b\u043e\u0432\u0435\u0447\u0435\u0441\u043a\u0438\u0439)<\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>if ($a.FileSystemRights.ToString() -eq &#171;ReadAndExecute, Synchronize&#187;) {$AccessType = &#171;\u0422\u043e\u043b\u044c\u043a\u043e \u0427\u0442\u0435\u043d\u0438\u0435&#187;}<\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>elseif ($a.FileSystemRights.ToString() -eq &#171;Modify, Synchronize&#187;) {$AccessType = &#171;\u0427\u0442\u0435\u043d\u0438\u0435 \u0438 \u0417\u0430\u043f\u0438\u0441\u044c&#187;}<\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>elseif ($a.FileSystemRights.ToString() -eq &#171;FullControl&#187;) {$AccessType = &#171;\u041f\u043e\u043b\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f&#187;}<\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>else {$AccessType = &#171;Custom&#187;}<\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>#\u0423\u0431\u0438\u0440\u0430\u0435\u043c \u0438\u0437 \u0438\u043c\u0435\u043d\u0438 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043e\u043c\u0435\u043d\u0430<\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>$name = $a.IdentityReference.Value.ToString().Replace($domain+&#187;&#187;,&#187;)<\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>#\u0412\u044b\u044f\u0441\u043d\u044f\u0435\u043c \u0433\u0440\u0443\u043f\u043f\u0430 \u0438\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c<\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>$ADObject = Get-ADObject -filter{SamAccountName -eq $name}<\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span><\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>if ($ADObject.ObjectClass.ToString() -eq &#171;user&#187;)&nbsp;<\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>{<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t<\/span>$data = $path+&#187;;;;&#187;+$name+&#187;;&#187;+$AccessType+&#187;;\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c&#187;<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t<\/span>#\u0417\u0430\u043f\u0438\u0441\u044c \u0432 \u0444\u0430\u0439\u043b<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t<\/span>Add-Content -Value $data -Path $DataFile -Encoding UTF8<\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>}<\/div>\n<div><\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>#\u0415\u0441\u043b\u0438 \u0433\u0440\u0443\u043f\u043f\u0430 &#8212; \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0432 \u0433\u0440\u0443\u043f\u043f\u0435<\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>if ($ADObject.ObjectClass.ToString() -eq &#171;group&#187;)&nbsp;<\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>{<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t<\/span>$group = $name<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $data = $path+&#187;;&#187;+$group+&#187;;;;&#187;+$AccessType+&#187;;\u0413\u0440\u0443\u043f\u043f\u0430&#187;<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t<\/span>#\u0417\u0430\u043f\u0438\u0441\u044c \u0432 \u0444\u0430\u0439\u043b<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t<\/span>Add-Content -Value $data -Path $DataFile -Encoding UTF8<\/div>\n<div><\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $gusers = Get-ADGroupMember $name<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t<\/span>foreach ($u in $gusers)<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t<\/span>{<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t<\/span>if ($u.ObjectClass.ToString() -eq &#171;user&#187;)&nbsp;<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t<\/span>{<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t\t<\/span>$name = $u.SamAccountName<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t\t<\/span>$data = $path+&#187;;&#187;+$group+&#187;;;&#187;+$name+&#187;;&#187;+$AccessType+&#187;;\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c&#187;<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t\t<\/span>#\u0417\u0430\u043f\u0438\u0441\u044c \u0432 \u0444\u0430\u0439\u043b<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t\t<\/span>Add-Content -Value $data -Path $DataFile -Encoding UTF8<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t<\/span>}<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t<\/span>#\u0415\u0441\u043b\u0438 \u0433\u0440\u0443\u043f\u043f\u0430 \u0432 \u0433\u0440\u0443\u043f\u043f\u0435 &#8212; \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0432 \u0433\u0440\u0443\u043f\u043f\u0435<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t<\/span>if ($u.ObjectClass.ToString() -eq &#171;group&#187;)&nbsp;<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t<\/span>{<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $name = $u.SamAccountName<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $pgroup = $name<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t\t<\/span>$data = $path+&#187;;&#187;+$group+&#187;;&#187;+$pgroup+&#187;;;&#187;+$AccessType+&#187;;\u0413\u0440\u0443\u043f\u043f\u0430&#187;<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t\t<\/span>#\u0417\u0430\u043f\u0438\u0441\u044c \u0432 \u0444\u0430\u0439\u043b<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t\t<\/span>Add-Content -Value $data -Path $DataFile -Encoding UTF8<\/div>\n<div><\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $userss = Get-ADGroupMember $u<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t\t<\/span>foreach ($uu in $userss)<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t\t<\/span>{<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t\t\t<\/span>$name = $uu.SamAccountName<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t\t\t<\/span>$data = $path+&#187;;&#187;+$group+&#187;;&#187;+$pgroup+&#187;;&#187;+$name+&#187;;&#187;+$AccessType+&#187;;\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c&#187;<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t\t\t<\/span>#\u0417\u0430\u043f\u0438\u0441\u044c \u0432 \u0444\u0430\u0439\u043b<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t\t\t<\/span>Add-Content -Value $data -Path $DataFile -Encoding UTF8<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t\t<\/span>}<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t<\/span>}<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t<\/span><\/div>\n<div><span style=\"white-space: pre;\">\t\t\t<\/span>}<\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>}<\/div>\n<div><span style=\"white-space: pre;\">\t<\/span>}<\/div>\n<div><\/div>\n<div>}<\/div>\n<div><\/div>\n<div>Foreach ($folder in $folder_path)&nbsp;<\/div>\n<div>{&nbsp; &nbsp;&nbsp;<\/div>\n<div>#\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043a\u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u043f\u0430\u043f\u043a\u0438<\/div>\n<div>$Acl = Get-Acl $folder.FullName<\/div>\n<div>$acl = $acl.Access<\/div>\n<div>#\u041f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u0441\u0442\u0443\u043f\u0430<\/div>\n<div>foreach ($a in $acl)<\/div>\n<div>{<\/div>\n<div><span style=\"white-space: pre;\">\t<\/span>#\u0411\u0435\u0440\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u043c\u0435\u043d\u043d\u044b\u0435 \u0443\u0447\u0435\u0442\u043a\u0438<\/div>\n<div><span style=\"white-space: pre;\">\t<\/span>if ($a.IdentityReference -match $domain)<\/div>\n<div><span style=\"white-space: pre;\">\t<\/span>{<\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>#\u041f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043d\u0430 \u0447\u0435\u043b\u043e\u0432\u0435\u0447\u0435\u0441\u043a\u0438\u0439)<\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>if ($a.FileSystemRights.ToString() -eq &#171;ReadAndExecute, Synchronize&#187;) {$AccessType = &#171;\u0422\u043e\u043b\u044c\u043a\u043e \u0427\u0442\u0435\u043d\u0438\u0435&#187;}<\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>elseif ($a.FileSystemRights.ToString() -eq &#171;Modify, Synchronize&#187;) {$AccessType = &#171;\u0427\u0442\u0435\u043d\u0438\u0435 \u0438 \u0417\u0430\u043f\u0438\u0441\u044c&#187;}<\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>elseif ($a.FileSystemRights.ToString() -eq &#171;FullControl&#187;) {$AccessType = &#171;\u041f\u043e\u043b\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f&#187;}<\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>else {$AccessType = &#171;Custom&#187;}<\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>#\u0423\u0431\u0438\u0440\u0430\u0435\u043c \u0438\u0437 \u0438\u043c\u0435\u043d\u0438 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043e\u043c\u0435\u043d\u0430<\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>$name = $a.IdentityReference.Value.ToString().Replace($domain+&#187;&#187;,&#187;)<\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>#\u0412\u044b\u044f\u0441\u043d\u044f\u0435\u043c \u0433\u0440\u0443\u043f\u043f\u0430 \u0438\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c<\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>$ADObject = Get-ADObject -filter{SamAccountName -eq $name}<\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span><\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>if ($ADObject.ObjectClass.ToString() -eq &#171;user&#187;)&nbsp;<\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>{<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t<\/span>$data = $folder.FullName+&#187;;;;&#187;+$name+&#187;;&#187;+$AccessType+&#187;;\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c&#187;<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t<\/span>#\u0417\u0430\u043f\u0438\u0441\u044c \u0432 \u0444\u0430\u0439\u043b<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t<\/span>Add-Content -Value $data -Path $DataFile -Encoding UTF8<\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>}<\/div>\n<div><\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>#\u0415\u0441\u043b\u0438 \u0433\u0440\u0443\u043f\u043f\u0430 &#8212; \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0432 \u0433\u0440\u0443\u043f\u043f\u0435<\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>if ($ADObject.ObjectClass.ToString() -eq &#171;group&#187;)&nbsp;<\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>{<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t<\/span>$group = $name<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $data = $folder.FullName+&#187;;&#187;+$group+&#187;;;;&#187;+$AccessType+&#187;;\u0413\u0440\u0443\u043f\u043f\u0430&#187;<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t<\/span>#\u0417\u0430\u043f\u0438\u0441\u044c \u0432 \u0444\u0430\u0439\u043b<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t<\/span>Add-Content -Value $data -Path $DataFile -Encoding UTF8<\/div>\n<div><\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $gusers = Get-ADGroupMember $name<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t<\/span>foreach ($u in $gusers)<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t<\/span>{<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t<\/span>if ($u.ObjectClass.ToString() -eq &#171;user&#187;)&nbsp;<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t<\/span>{<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t\t<\/span>$name = $u.SamAccountName<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t\t<\/span>$data = $folder.FullName+&#187;;&#187;+$group+&#187;;;&#187;+$name+&#187;;&#187;+$AccessType+&#187;;\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c&#187;<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t\t<\/span>#\u0417\u0430\u043f\u0438\u0441\u044c \u0432 \u0444\u0430\u0439\u043b<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t\t<\/span>Add-Content -Value $data -Path $DataFile -Encoding UTF8<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t<\/span>}<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t<\/span>#\u0415\u0441\u043b\u0438 \u0433\u0440\u0443\u043f\u043f\u0430 \u0432 \u0433\u0440\u0443\u043f\u043f\u0435 &#8212; \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0432 \u0433\u0440\u0443\u043f\u043f\u0435<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t<\/span>if ($u.ObjectClass.ToString() -eq &#171;group&#187;)&nbsp;<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t<\/span>{<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $name = $u.SamAccountName<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $pgroup = $name<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t\t<\/span>$data = $folder.FullName+&#187;;&#187;+$group+&#187;;&#187;+$pgroup+&#187;;;&#187;+$AccessType+&#187;;\u0413\u0440\u0443\u043f\u043f\u0430&#187;<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t\t<\/span>#\u0417\u0430\u043f\u0438\u0441\u044c \u0432 \u0444\u0430\u0439\u043b<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t\t<\/span>Add-Content -Value $data -Path $DataFile -Encoding UTF8<\/div>\n<div><\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $userss = Get-ADGroupMember $u<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t\t<\/span>foreach ($uu in $userss)<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t\t<\/span>{<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t\t\t<\/span>$name = $uu.SamAccountName<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t\t\t<\/span>$data = $folder.FullName+&#187;;&#187;+$group+&#187;;&#187;+$pgroup+&#187;;&#187;+$name+&#187;;&#187;+$AccessType+&#187;;\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c&#187;<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t\t\t<\/span>#\u0417\u0430\u043f\u0438\u0441\u044c \u0432 \u0444\u0430\u0439\u043b<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t\t\t<\/span>Add-Content -Value $data -Path $DataFile -Encoding UTF8<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t\t<\/span>}<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t<\/span>}<\/div>\n<div><span style=\"white-space: pre;\">\t\t\t\t<\/span><\/div>\n<div><span style=\"white-space: pre;\">\t\t\t<\/span>}<\/div>\n<div><span style=\"white-space: pre;\">\t\t<\/span>}<\/div>\n<div><span style=\"white-space: pre;\">\t<\/span>}<\/div>\n<div><\/div>\n<div>}<\/div>\n<div>}<\/div>\n<\/div>\n<\/blockquote>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0442\u0430\u043a \u0436\u0435 \u043d\u0430\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b:&nbsp;<a href=\"https:\/\/fixmypc.ru\/post\/kak-rabotat-s-razresheniiami-ntfs-acl-v-powershell\/\">https:\/\/fixmypc.ru\/post\/kak-rabotat-s-razresheniiami-ntfs-acl-v-powershell\/<\/a>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0421\u0430\u043c\u044b\u0439 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u044d\u0442\u043e \u0432\u0437\u044f\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 PowerShell, \u043f\u043e\u0434\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u043f\u043e\u0434 \u0441\u0435\u0431\u044f \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c. \u0425\u043e\u0440\u043e\u0448\u0438\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430\u0448\u0435\u043b \u0442\u0443\u0442:&nbsp;https:\/\/itbru.ru\/index.php\/2017\/08\/02\/powershell-sozdanie-spiska-userov\/. \u0415\u0441\u0442\u044c \u0443 \u043d\u0435\u0433\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438: \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0438\u043c\u0435\u0435\u0442 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u0440\u0443\u043f\u043f; \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443, \u043d\u043e \u0438 \u043f\u043e\u0434\u043f\u0430\u043f\u043a\u0438 \u0432 \u044d\u0442\u043e\u0439 \u043f\u0430\u043f\u043a\u0435. \u0422.\u0435. \u0435\u0441\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u0430, \u0432 \u0433\u0440\u0443\u043f\u043f\u0435 \u0435\u0441\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u0433\u0440\u0443\u043f\u043f\u044b, \u0430 \u0443\u0436\u0435 \u0432 \u044d\u0442\u0438\u0445 \u043f\u043e\u0434\u0433\u0440\u0443\u043f\u043f\u0430\u0445 \u0435\u0441\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15,17,16,9,7],"tags":[],"class_list":["post-21","post","type-post","status-publish","format-standard","hentry","category-active-directory","category-manual","category-powershell","category-windows","category-7"],"_links":{"self":[{"href":"https:\/\/mohn.ru\/index.php?rest_route=\/wp\/v2\/posts\/21","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mohn.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohn.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohn.ru\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohn.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=21"}],"version-history":[{"count":1,"href":"https:\/\/mohn.ru\/index.php?rest_route=\/wp\/v2\/posts\/21\/revisions"}],"predecessor-version":[{"id":405,"href":"https:\/\/mohn.ru\/index.php?rest_route=\/wp\/v2\/posts\/21\/revisions\/405"}],"wp:attachment":[{"href":"https:\/\/mohn.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=21"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohn.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=21"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohn.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=21"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}