{"id":160837,"date":"2012-11-30T14:39:03","date_gmt":"2012-11-30T10:39:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=160837"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=160837","title":{"rendered":"<span class=\"post_title\">10 \u0437\u0430\u0434\u0430\u0447 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f Active Directory, \u0440\u0435\u0448\u0430\u0435\u043c\u044b\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PowerShell<\/span>"},"content":{"rendered":"<div class=\"content html_format\">       <img decoding=\"async\" align=\"right\" src=\"http:\/\/habrastorage.org\/storage2\/eef\/1be\/c68\/eef1bec6878c24a31ad68b76ed06356e.jpg\"\/><a href=\"http:\/\/jdhitsolutions.com\/\">\u0414\u0436\u0435\u0444\u0444\u0435\u0440\u0438 \u0425\u0438\u043a\u0441 <\/a>\u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b <a href=\"http:\/\/www.windowsitpro.com\/article\/windows-powershell\/top-10-active-directory-tasks-solved-powershell-144567\">\u0441\u0442\u0430\u0442\u044c\u044e \u043d\u0430 Windows IT Pro<\/a>, \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u043d\u0443\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f PowerShell \u0434\u043b\u044f \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f AD. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430 \u0430\u0432\u0442\u043e\u0440 \u0440\u0435\u0448\u0438\u043b \u0432\u0437\u044f\u0442\u044c 10 \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f AD \u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0442\u043e, \u043a\u0430\u043a \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f PowerShell:  <\/p>\n<ol>\n<li>\u0421\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/li>\n<li>\u0410\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0434\u0435\u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0447\u0435\u0442\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438<\/li>\n<li>\u0420\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0447\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/li>\n<li>\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0443\u0447\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c<\/li>\n<li>\u041d\u0430\u0439\u0442\u0438 \u043f\u0443\u0441\u0442\u044b\u0435 \u0433\u0440\u0443\u043f\u043f\u044b<\/li>\n<li>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0432 \u0433\u0440\u0443\u043f\u043f\u0443<\/li>\n<li>\u0412\u044b\u0432\u0435\u0441\u0442\u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u0447\u043b\u0435\u043d\u043e\u0432 \u0433\u0440\u0443\u043f\u043f\u044b<\/li>\n<li>\u041d\u0430\u0439\u0442\u0438 \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u0435 \u0443\u0447\u0435\u0442\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u0432<\/li>\n<li>\u0414\u0435\u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0447\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430<\/li>\n<li>\u041d\u0430\u0439\u0442\u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u044b \u043f\u043e \u0442\u0438\u043f\u0443<\/li>\n<\/ol>\n<p>  \u041f\u043e\u043c\u0438\u043c\u043e \u044d\u0442\u043e\u0433\u043e \u0430\u0432\u0442\u043e\u0440 \u0432\u0435\u0434\u0435\u0442 \u0431\u043b\u043e\u0433 (\u043f\u043e PowerShell, \u043a\u043e\u043d\u0435\u0447\u043d\u043e), \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u2014 <a href=\"http:\/\/jdhitsolutions.com\/blog\/\">jdhitsolutions.com\/blog\/<\/a>. \u0410 \u0441\u0430\u043c\u043e\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0437 \u0435\u0433\u043e \u0442\u0432\u0438\u0442\u0442\u0435\u0440\u0430 <a href=\"http:\/\/twitter.com\/jeffhicks\">twitter.com\/jeffhicks<\/a>. <br \/>  \u0418\u0442\u0430\u043a, \u043d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043c \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u0442\u0430\u0442\u044c\u0438 \u201cTop 10 Active Directory Tasks Solved with PowerShell\u201d.<a name=\"habracut\"><\/a><\/p>\n<p>  \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 Active Directory (AD) \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Windows PowerShell \u2013 \u044d\u0442\u043e \u043f\u0440\u043e\u0449\u0435, \u0447\u0435\u043c \u0412\u044b \u0434\u0443\u043c\u0430\u0435\u0442\u0435, \u0438 \u044f \u0445\u043e\u0447\u0443 \u0434\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0412\u0430\u043c \u044d\u0442\u043e. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0437\u044f\u0442\u044c \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u043d\u0438\u0436\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0438 \u0441 \u0438\u0445 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0435\u0448\u0438\u0442\u044c \u0440\u044f\u0434 \u0437\u0430\u0434\u0430\u0447 \u043f\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e AD.<\/p>\n<h4>\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f<\/h4>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c PowerShell \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f AD, \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0431\u043b\u044e\u0441\u0442\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439. \u042f \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0441\u044c \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043a\u0430\u043a \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442\u044b \u0434\u043b\u044f AD \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \u043d\u0430 Windows 7.<br \/>  \u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442\u044b, \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0434\u043e\u043c\u0435\u043d\u0430 \u0443 \u0412\u0430\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0443\u0440\u043e\u0432\u043d\u044f Windows Server 2008 R2, \u0438\u043b\u0438 \u0436\u0435 \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c <a href=\"http:\/\/www.microsoft.com\/download\/en\/details.aspx?id=2852\">Active Directory Management Gateway Service <\/a>\u043d\u0430 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u044b\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u0445 \u0434\u043e\u043c\u0435\u043d\u0430 (legacy DCs). \u0412\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u043f\u0435\u0440\u0435\u0434 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439; \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u041a\u0414.<br \/>  \u041d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u0441\u043a\u0430\u0447\u0430\u0439\u0442\u0435 \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 <b>Remote Server Administration Tools <\/b>(RSAT) \u043b\u0438\u0431\u043e \u0434\u043b\u044f <a href=\"http:\/\/www.microsoft.com\/download\/en\/details.aspx?id=7887\">Windows 7<\/a>, \u043b\u0438\u0431\u043e \u0434\u043b\u044f <a href=\"http:\/\/www.microsoft.com\/download\/en\/details.aspx?id=28972\">Windows 8<\/a>. \u0412 Windows 7, \u0412\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0432 <i>\u041f\u0430\u043d\u0435\u043b\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f (Control Panel)<\/i> \u0440\u0430\u0437\u0434\u0435\u043b <i>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b (Programs)<\/i> \u0438 \u0432\u044b\u0431\u0440\u0430\u0442\u044c <i>\u0412\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438\u043b\u0438 \u0432\u044b\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 Windows (Turn Windows Features On or Off)<\/i>. \u041d\u0430\u0439\u0434\u0438\u0442\u0435 <i>Remote Server Administration Tools <\/i>\u0438 \u0440\u0430\u0441\u043a\u0440\u043e\u0439\u0442\u0435 \u0440\u0430\u0437\u0434\u0435\u043b <i>Role Administration Tools<\/i>. \u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u043f\u0443\u043d\u043a\u0442\u044b \u0434\u043b\u044f AD DS and AD LDS Tools, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0432\u044b\u0431\u0440\u0430\u043d \u043f\u0443\u043d\u043a\u0442 <i>Active Directory Module for Windows PowerShell<\/i>, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 1. (\u0412 Windows 8 \u0432\u0441\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0432\u044b\u0431\u0440\u0430\u043d\u044b \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e). \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0433\u043e\u0442\u043e\u0432\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/90d\/472\/d83\/90d472d83296fbe2ef85b3c7c4959e56.jpg\"\/><br \/>  \u0420\u0438\u0441.1 \u0412\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 AD DS \u0438 AD LDS Tools <\/p>\n<p>  \u042f \u0432\u043e\u0448\u0435\u043b \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043f\u043e\u0434 \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u044c\u044e \u0441 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u0434\u043e\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430. \u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u0431\u0443\u0434\u0443 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0442 \u0412\u0430\u043c \u0443\u0442\u043e\u0447\u043d\u0438\u0442\u044c \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u043f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u044f (credentials). \u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u043f\u0440\u0430\u0432\u043a\u0443 (<b>Get-Help<\/b>) \u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u0431\u0443\u0434\u0443 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0438\u0436\u0435.<br \/>  \u041d\u0430\u0447\u043d\u0438\u0442\u0435 \u0441\u0435\u0441\u0441\u0438\u044e PowerShell \u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u043c\u043e\u0434\u0443\u043b\u044c:<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; Import-Module ActiveDirectory <\/code><\/pre>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0439 PSDrive, \u043d\u043e \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e. \u041e\u0434\u043d\u0430\u043a\u043e, \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u0432 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u043c\u043e\u0434\u0443\u043b\u0435. <\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; get-command -module ActiveDirectory <\/code><\/pre>\n<p>  \u041f\u0440\u0435\u043b\u0435\u0441\u0442\u044c \u044d\u0442\u0438\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u044f \u043c\u043e\u0433\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 AD, \u0442\u043e \u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f 10, 100 \u0438 \u0434\u0430\u0436\u0435 1000. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u044d\u0442\u0438\u0445 \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442.<\/p>\n<h4>\u0417\u0430\u0434\u0430\u0447\u0430 1: \u0421\u0431\u0440\u043e\u0441 \u043f\u0430\u0440\u043e\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/h4>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0447\u043d\u0435\u043c \u0441 \u0442\u0438\u043f\u0438\u0447\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438: \u0441\u0431\u0440\u043e\u0441 \u043f\u0430\u0440\u043e\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043b\u0435\u0433\u043a\u043e \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442 <b>Set-ADAccountPassword<\/b>. \u0421\u043b\u043e\u0436\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u043e\u0432\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0443\u0442\u043e\u0447\u043d\u0435\u043d \u043a\u0430\u043a \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430: \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0442\u0435\u043a\u0441\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d \u0438 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0430 \u043f\u0440\u043e\u0442\u044f\u0436\u0435\u043d\u0438\u0438 PowerShell \u0441\u0435\u0441\u0441\u0438\u0438. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0441 \u043d\u043e\u0432\u044b\u043c \u043f\u0430\u0440\u043e\u043b\u0435\u043c:   <\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; $new=Read-Host &quot;Enter the new password&quot; -AsSecureString <\/code><\/pre>\n<p>  \u0417\u0430\u0442\u0435\u043c, \u0432\u0432\u0435\u0434\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c:<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0443\u0447\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c (\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <b>samAccountname <\/b>\u2013 \u043b\u0443\u0447\u0448\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442) \u0438 \u0437\u0430\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c. \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f Jack Frost:<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; Set-ADAccountPassword jfrost -NewPassword $new <\/code><\/pre>\n<p>  \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u044d\u0442\u0438\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442\u043e\u043c \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u0442\u0441\u044f \u0431\u0430\u0433: <i>-Passthru<\/i>, <i>-Whatif<\/i>, \u0438 <i>\u2013Confirm <\/i>\u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442. \u0415\u0441\u043b\u0438 \u0412\u044b \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u0435\u0442\u0435 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 \u043f\u0443\u0442\u044c, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; Set-ADAccountPassword jfrost -NewPassword (ConvertTo-SecureString -AsPlainText -String &quot;P@ssw0rd1z3&quot; -force) <\/code><\/pre>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u043c\u043d\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u0447\u0442\u043e\u0431\u044b Jack \u0441\u043c\u0435\u043d\u0438\u043b \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u0440\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0432\u0445\u043e\u0434\u0435 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u0438 \u044f \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u044e \u0443\u0447\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <b>Set-ADUser<\/b>.<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; Set-ADUser jfrost -ChangePasswordAtLogon $True <\/code><\/pre>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442\u0430 \u043d\u0435 \u043f\u0438\u0448\u0443\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 <b>\u2013True<\/b>. \u041d\u043e \u044f \u043c\u043e\u0433\u0443 \u0443\u0437\u043d\u0430\u0442\u044c, \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0438\u043b\u0438 \u043d\u0435\u0442 \u043f\u0440\u043e\u0448\u043b\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f, \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u044f \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442\u0430 <b>Get-ADUser <\/b>\u0438 \u0443\u0442\u043e\u0447\u043d\u0438\u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <b>PasswordExpired<\/b>, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 2.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/278\/1ee\/f74\/2781eef746da3defe31843b339e5f0e2.jpg\"\/><br \/>  \u0420\u0438\u0441. 2. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442\u0430 Get-ADUser Cmdlet \u0441\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e\u043c PasswordExpired<\/p>\n<p>  \u0418\u0442\u043e\u0433: \u0441\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PowerShell \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e. \u041f\u0440\u0438\u0437\u043d\u0430\u044e\u0441\u044c, \u0447\u0442\u043e \u0441\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0447\u0435\u0440\u0435\u0437 \u043e\u0441\u043d\u0430\u0441\u0442\u043a\u0443<i> Active Directory Users and Computers<\/i> \u043a\u043e\u043d\u0441\u043e\u043b\u0438 <i>Microsoft Management Console (MMC). <\/i>\u041d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 PowerShell \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0412\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443, \u0412\u044b \u043d\u0435 \u0445\u043e\u0442\u0438\u0442\u0435 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u0432\u044b\u0448\u0435\u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u0443\u044e \u043e\u0441\u043d\u0430\u0441\u0442\u043a\u0443 \u0438\u043b\u0438 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0435 \u043f\u0430\u0440\u043e\u043b\u044c \u0432 \u0445\u043e\u0434\u0435 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0418\u0422-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430.<\/p>\n<h4>\u0417\u0430\u0434\u0430\u0447\u0430 2: \u0410\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0434\u0435\u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0447\u0435\u0442\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438<\/h4>\n<p>  \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u0435\u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u043c \u0443\u0447\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 Jack Frost. \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <b>\u2013Whatif<\/b>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u044c \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u043a\u043e\u043c\u0430\u0434\u043b\u0435\u0442\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u044e\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043c\u043e\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044f \u0435\u0435. <\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; Disable-ADAccount jfrost -whatif What if: Performing operation &quot;Set&quot; on Target &quot;CN=Jack Frost, OU=staff,OU=Testing,DC=GLOBOMANTICS,DC=local&quot;. <\/code><\/pre>\n<p>  \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0435\u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u043c \u043f\u043e-\u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u043c\u0443:<\/p>\n<pre><code class=\"vbscript\"> PS C:\\&gt; Disable-ADAccount jfrost<\/code><\/pre>\n<p>  \u0410 \u043a\u043e\u0433\u0434\u0430 \u043d\u0430\u0441\u0442\u0430\u043d\u0435\u0442 \u0432\u0440\u0435\u043c\u044f \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0447\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c, \u043a\u0430\u043a\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442 \u043d\u0430\u043c \u043f\u043e\u043c\u043e\u0436\u0435\u0442? <\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; Enable-ADAccount jfrost <\/code><\/pre>\n<p>  \u042d\u0442\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u0432 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u043d\u043e\u043c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0438 (pipelined expression), \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044f \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u043b\u0438 \u0434\u0435\u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0447\u0435\u0442\u043d\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0443\u0448\u0435 \u0443\u0433\u043e\u0434\u043d\u043e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0434\u0435\u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u0442 \u0432\u0441\u0435 \u0443\u0447\u0435\u0442\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u043e\u0442\u0434\u0435\u043b\u0435 \u043f\u0440\u043e\u0434\u0430\u0436 (Sales)<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; get-aduser -filter &quot;department -eq 'sales'&quot; | disable-adaccount <\/code><\/pre>\n<p>  \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440 \u0434\u043b\u044f <b>Get-ADUser <\/b>\u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e-\u0442\u0430\u043a\u0438 \u0441\u043b\u043e\u0436\u043d\u043e, \u043d\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0437\u0434\u0435\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <b>\u2013Whatif <\/b>\u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442\u043e\u043c <b>Disable-ADAccount <\/b>\u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c.<\/p>\n<h4>\u0417\u0430\u0434\u0430\u0447\u0430 3: \u0420\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0447\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/h4>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e, \u043a\u043e\u0433\u0434\u0430 Jack \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043b \u0441\u0432\u043e\u044e \u0443\u0447\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c, \u043f\u044b\u0442\u0430\u044f\u0441\u044c \u0432\u0432\u0435\u0441\u0442\u0438 \u043d\u043e\u0432\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c. \u0412\u043c\u0435\u0441\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u0439\u0442\u0438 \u0435\u0433\u043e \u0443\u0447\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0447\u0435\u0440\u0435\u0437 GUI, \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u0440\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b.<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; Unlock-ADAccount jfrost <\/code><\/pre>\n<p>  \u041a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b <b>-Whatif <\/b>\u0438 <b>-Confirm<\/b>.<\/p>\n<h4>\u0417\u0430\u0434\u0430\u0447\u0430 4: \u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0443\u0447\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c<\/h4>\n<p>  \u041d\u0435\u0432\u0430\u0436\u043d\u043e, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0412\u044b \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0435, \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442\u0430 <b>Remove-ADUser<\/b>. \u041c\u043d\u0435 \u043d\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0443\u0434\u0430\u043b\u044f\u0442\u044c Jack Frost, \u043d\u043e \u0435\u0441\u043b\u0438 \u0431\u044b \u044f \u0437\u0430\u0445\u043e\u0442\u0435\u043b, \u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0431\u044b \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; Remove-ADUser jfrost -whatif What if: Performing operation &quot;Remove&quot; on Target &quot;CN=Jack Frost,OU=staff,OU=Testing,DC=GLOBOMANTICS,DC=local&quot;. <\/code><\/pre>\n<p>  \u0418\u043b\u0438 \u044f \u043c\u043e\u0433\u0443 \u0432\u0432\u0435\u0441\u0442\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0438\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u0434\u043d\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; get-aduser -filter &quot;enabled -eq 'false'&quot; -property WhenChanged -SearchBase &quot;OU=Employees, DC=Globomantics,DC=Local&quot; | where {$_.WhenChanged -le (Get-Date).AddDays(-180)} | Remove-ADuser -whatif <\/code><\/pre>\n<p>  \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u0439\u0434\u0435\u043d\u044b \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u044b \u0432\u0441\u0435 \u0434\u0435\u0430\u043a\u0442\u0438\u0432\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0443\u0447\u0435\u0442\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u043f\u043e\u0434\u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f (OU) Employees, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043c\u0435\u043d\u044f\u043b\u0438\u0441\u044c \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 180 \u0438 \u0431\u043e\u043b\u0435\u0435 \u0434\u043d\u0435\u0439.<\/p>\n<h4>\u0417\u0430\u0434\u0430\u0447\u0430 5: \u041f\u043e\u0438\u0441\u043a \u043f\u0443\u0441\u0442\u044b\u0445 \u0433\u0440\u0443\u043f\u043f<\/h4>\n<p>  \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0433\u0440\u0443\u043f\u043f\u0430\u043c\u0438 \u2013 \u0437\u0430\u043d\u044f\u0442\u0438\u0435 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0435 \u0438 \u043d\u0435\u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u043d\u043e\u0435. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u043d\u0430\u0439\u0442\u0438 \u043f\u0443\u0441\u0442\u044b\u0435 \u0433\u0440\u0443\u043f\u043f\u044b. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043b\u0443\u0447\u0448\u0435, \u0447\u0435\u043c \u0434\u0440\u0443\u0433\u0438\u0435, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0412\u0430\u0448\u0435\u0439 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438. \u041a\u043e\u0434, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u043d\u0438\u0436\u0435, \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435 \u0433\u0440\u0443\u043f\u043f\u044b \u0432 \u0434\u043e\u043c\u0435\u043d\u0435, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 (built-in). <\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; get-adgroup -filter * | where {-Not ($_ | get-adgroupmember)} | Select Name <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0443 \u0412\u0430\u0441 \u0435\u0441\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u044b \u0441 \u0441\u043e\u0442\u043d\u044f\u043c\u0438 \u0447\u043b\u0435\u043d\u043e\u0432, \u0442\u043e\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043d\u044f\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438; <b>Get-ADGroupMember<\/b> \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043a\u0430\u0436\u0434\u0443\u044e \u0433\u0440\u0443\u043f\u043f\u0443. \u0415\u0441\u043b\u0438 \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u0438\u043b\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c, \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043b\u0443\u0447\u0448\u0435.<br \/>  \u0412\u043e\u0442 \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u043f\u043e\u0434\u0445\u043e\u0434:<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; get-adgroup -filter &quot;members -notlike '*' -AND GroupScope -eq 'Universal'&quot; -SearchBase &quot;OU=Groups,OU=Employees,DC=Globomantics, DC=local&quot; | Select Name,Group* <\/code><\/pre>\n<p>  \u042d\u0442\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0432\u0441\u0435 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0435 \u0433\u0440\u0443\u043f\u043f\u044b (Universal groups), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0438\u043c\u0435\u044e\u0442 \u0447\u043b\u0435\u043d\u0441\u0442\u0432\u043e \u0432 OU Groups \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u0441\u0432\u043e\u0439\u0441\u0442\u0432. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 3.<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/1bf\/3b6\/f8b\/1bf3b6f8bb103d8ecf02ec7fd1ab1654.jpg\"\/><br \/>  \u0420\u0438\u0441. 3. \u041f\u043e\u0438\u0441\u043a \u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0445 \u0433\u0440\u0443\u043f\u043f<\/p>\n<h4>\u0417\u0430\u0434\u0430\u0447\u0430 6: \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0432 \u0433\u0440\u0443\u043f\u043f\u0443<\/h4>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c Jack Frost \u0432 \u0433\u0440\u0443\u043f\u043f\u0443 Chicago IT:<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; add-adgroupmember &quot;chicago IT&quot; -Members jfrost <\/code><\/pre>\n<p>  \u0414\u0430, \u0432\u0441\u0435 \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0442\u0430\u043a\u0436\u0435 \u043b\u0435\u0433\u043a\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043e\u0442\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0432 \u0433\u0440\u0443\u043f\u043f\u044b, \u0445\u043e\u0442\u044f, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u044d\u0442\u043e \u0441\u043b\u0435\u0433\u043a\u0430 \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e:<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; Add-ADGroupMember &quot;Chicago Employees&quot; -member (get-aduser -filter &quot;city -eq 'Chicago'&quot;) <\/code><\/pre>\n<p>  \u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0432\u0432\u043e\u0434\u043d\u043e\u0435 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 (parenthetical pipelined expression), \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e City \u0432 Chicago. \u041a\u043e\u0434 \u0432 \u0441\u043a\u043e\u0431\u043a\u0430\u0445 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f, \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u2013Member. \u041a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u0433\u0440\u0443\u043f\u043f\u0443 Chicago Employees. \u041d\u0435\u0432\u0430\u0436\u043d\u043e, \u0438\u043c\u0435\u0435\u043c \u043b\u0438 \u043c\u044b \u0434\u0435\u043b\u043e \u0441 5 \u0438\u043b\u0438 5000 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0447\u043b\u0435\u043d\u0441\u0442\u0432\u0430 \u0432 \u0433\u0440\u0443\u043f\u043f\u0430\u0445 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0432\u0441\u0435\u0433\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u043a\u0443\u043d\u0434. \u042d\u0442\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0442\u0430\u043a\u0436\u0435 \u0431\u044b\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <b>ForEach-Object<\/b>, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0434\u043e\u0431\u043d\u0435\u0435: <\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; Get-ADUser -filter &quot;city -eq 'Chicago'&quot; | foreach {Add-ADGroupMember &quot;Chicago Employees&quot; -Member $_} <\/code><\/pre>\n<p>  \u0417\u0430\u0434\u0430\u0447\u0430 7: \u0412\u044b\u0432\u043e\u0434\u0438\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0447\u043b\u0435\u043d\u043e\u0432 \u0433\u0440\u0443\u043f\u043f\u044b<\/p>\n<p>  \u0412\u044b \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0437\u043d\u0430\u0442\u044c, \u043a\u0442\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0412\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u0437\u043d\u0430\u0432\u0430\u0442\u044c, \u043a\u0442\u043e \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u0433\u0440\u0443\u043f\u043f\u0443 \u0434\u043e\u043c\u0435\u043d\u043d\u044b\u0445 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u043e\u0432 (Domain Admins):<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; Get-ADGroupMember &quot;Domain Admins&quot; <\/code><\/pre>\n<p>  \u041d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 4 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/88e\/995\/b0d\/88e995b0d0b3efd253bba72856e7d29e.jpg\"\/><br \/>  \u0420\u0438\u0441. 4. \u0427\u043b\u0435\u043d\u044b \u0433\u0440\u0443\u043f\u043f\u044b Domain Admins <\/p>\n<p>  \u041a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 AD \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0447\u043b\u0435\u043d\u0430 \u0433\u0440\u0443\u043f\u043f\u044b. \u0410 \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c\u0438 \u0433\u0440\u0443\u043f\u043f\u0430\u043c\u0438? \u041c\u043e\u044f \u0433\u0440\u0443\u043f\u043f\u0430 Chicago All Users \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0435\u0439 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0433\u0440\u0443\u043f\u043f. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0443\u0447\u0435\u0442\u043d\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u044f \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <b>\u2013Recursive<\/b>.<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; Get-ADGroupMember &quot;Chicago All Users&quot; -Recursive | Select DistinguishedName <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0412\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u0439\u0442\u0438 \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0443\u0442\u0435\u043c \u2013 \u043d\u0430\u0439\u0442\u0438, \u0432 \u043a\u0430\u043a\u0438\u0445 \u0433\u0440\u0443\u043f\u043f\u0430\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441\u043e\u0441\u0442\u043e\u0438\u0442, \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f <b>MemberOf<\/b>:<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; get-aduser jfrost -property Memberof | Select -ExpandProperty memberOf CN=NewTest,OU=Groups,OU=Employees, DC=GLOBOMANTICS,DC=local CN=Chicago Test,OU=Groups,OU=Employees, DC=GLOBOMANTICS,DC=local CN=Chicago IT,OU=Groups,OU=Employees, DC=GLOBOMANTICS,DC=local CN=Chicago Sales Users,OU=Groups,OU=Employees, DC=GLOBOMANTICS,DC=local <\/code><\/pre>\n<p>  \u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <b>-ExpandProperty<\/b>, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0438\u043c\u0435\u043d\u0430 <b>MemberOf <\/b>\u043a\u0430\u043a \u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n<h4>\u0417\u0430\u0434\u0430\u0447\u0430 8: \u041d\u0430\u0439\u0442\u0438 \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u0435 \u0443\u0447\u0435\u0442\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u0432<\/h4>\n<p>  \u041c\u043d\u0435 \u0447\u0430\u0441\u0442\u043e \u0437\u0430\u0434\u0430\u044e\u0442 \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441: \u201c\u041a\u0430\u043a \u043d\u0430\u0439\u0442\u0438 \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u0435 \u0443\u0447\u0435\u0442\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u0432?\u201d. \u0418 \u044f \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0442\u0432\u0435\u0447\u0430\u044e: \u201c\u0410 \u0447\u0442\u043e \u0434\u043b\u044f \u0432\u0430\u0441 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u043c?\u201d \u041a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u0442\u043e, \u043a\u043e\u0433\u0434\u0430 \u0443\u0447\u0435\u0442\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 (\u0438\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043d\u0435\u0432\u0430\u0436\u043d\u043e), \u043f\u0440\u0438\u0437\u043d\u0430\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0435\u0439 \u0438 \u043d\u0435 \u043f\u043e\u0434\u043b\u0435\u0436\u0438\u0442 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e. \u0427\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u043d\u044f, \u0442\u043e \u044f \u043e\u0431\u0440\u0430\u0449\u0430\u044e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u0435 \u0443\u0447\u0435\u0442\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438, \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0430\u0440\u043e\u043b\u0438 \u043d\u0435 \u043c\u0435\u043d\u044f\u043b\u0438\u0441\u044c \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u042d\u0442\u043e\u0442 \u043f\u0435\u0440\u0438\u043e\u0434 \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 90 \u0434\u043d\u0435\u0439 \u2013 \u0435\u0441\u043b\u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u043d\u0435 \u0441\u043c\u0435\u043d\u0438\u043b \u043f\u0430\u0440\u043e\u043b\u044c \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0434\u043e\u043c\u0435\u043d\u043e\u043c \u0437\u0430 \u044d\u0442\u043e\u0442 \u043f\u0435\u0440\u0438\u043e\u0434, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043e\u043d \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043e\u0444\u0444\u043b\u0430\u0439\u043d \u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u043c. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442 <b>Get-ADComputer<\/b>:<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; get-adcomputer -filter &quot;Passwordlastset -lt '1\/1\/2012'&quot; -properties *| Select name,passwordlastset <\/code><\/pre>\n<p>  \u0424\u0438\u043b\u044c\u0442\u0440 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u0436\u0435\u0441\u0442\u043a\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c, \u043d\u043e \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0443\u0447\u0435\u0442\u043d\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0438 \u0441\u0432\u043e\u0438\u0445 \u043f\u0430\u0440\u043e\u043b\u0435\u0439 \u0441 1 \u044f\u043d\u0432\u0430\u0440\u044f 2012 \u0433\u043e\u0434\u0430. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 5.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/759\/524\/588\/7595245888d0c0bed70e391143191fa8.jpg\"\/><br \/>  \u0420\u0438\u0441. 5. \u041d\u0430\u0445\u043e\u0434\u0438\u043c \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u0435 \u0443\u0447\u0435\u0442\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u0432 <\/p>\n<p>  \u0414\u0440\u0443\u0433\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442: \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0432\u044b \u0445\u043e\u0442\u044f \u0431\u044b \u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0434\u043e\u043c\u0435\u043d\u0430 Windows 2003. \u041f\u043e\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0444\u0438\u043b\u044c\u0442\u0440 \u043f\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443 <b>LastLogontimeStamp<\/b>. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u2013 \u0447\u0438\u0441\u043b\u043e 100 \u043d\u0430\u043d\u043e\u0441\u0435\u043a\u0443\u043d\u0434\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u0432 \u0441 1 \u044f\u043d\u0432\u0430\u0440\u044f, 1601 \u0433\u043e\u0434\u0430, \u0438 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0432 GMT, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u044d\u0442\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0441\u043b\u0435\u0433\u043a\u0430 \u0441\u043b\u043e\u0436\u043d\u043e:<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; get-adcomputer -filter &quot;LastlogonTimestamp -gt 0&quot; -properties * | select name,lastlogontimestamp, @{Name=&quot;LastLogon&quot;;Expression={[datetime]::FromFileTime ($_.Lastlogontimestamp)}},passwordlastset | Sort LastLogonTimeStamp <\/code><\/pre>\n<p>  \u042f \u0432\u0437\u044f\u043b \u043d\u0430 \u0441\u0435\u0431\u044f \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0435\u0440\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <b>LastLogontimeStamp <\/b>\u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u0435\u0433\u043e \u0432 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442. \u041d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 6 \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/759\/524\/588\/7595245888d0c0bed70e391143191fa8.jpg\"\/><br \/>  \u0420\u0438\u0441. 6. \u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 LastLogonTimeStamp \u0432 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 <\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440, \u043c\u043d\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u0442\u0443, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 1 \u044f\u043d\u0432\u0430\u0440\u044f 2012, \u0432 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442. \u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 FileTime:<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; $cutoff=(Get-Date &quot;1\/1\/2012&quot;).ToFileTime() PS C:\\&gt; $cutoff 129698676000000000 <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u044f \u043c\u043e\u0433\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0432 \u0444\u0438\u043b\u044c\u0442\u0440\u0435 \u0434\u043b\u044f <b>Get-ADComputer<\/b>:<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; Get-ADComputer -Filter &quot;(lastlogontimestamp -lt $cutoff) -or (lastlogontimestamp -notlike '*')&quot; -property * | Select Name,LastlogonTimestamp,PasswordLastSet <\/code><\/pre>\n<p>  \u041f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0442\u0435 \u0436\u0435 \u0441\u0430\u043c\u044b\u0435 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u044b, \u0447\u0442\u043e \u0431\u044b\u043b\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u044b \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 5. <\/p>\n<h4>\u0417\u0430\u0434\u0430\u0447\u0430 9: \u0414\u0435\u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0447\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430<\/h4>\n<p>  \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u0412\u044b \u043d\u0430\u0439\u0434\u0435\u0442\u0435 \u043d\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u0438\u043b\u0438 \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u0435 \u0443\u0447\u0435\u0442\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438, \u0412\u044b \u0437\u0430\u0445\u043e\u0442\u0438\u0442\u0435 \u0434\u0435\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445. \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u0442 \u0436\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0443\u0447\u0435\u0442\u043d\u044b\u043c\u0438 \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0442\u043e\u0447\u043d\u0438\u0442\u044c \u0435\u0433\u043e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0432 <b>samAccountname <\/b>\u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438.<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; Disable-ADAccount -Identity &quot;chi-srv01$&quot; -whatif \tWhat if: Performing operation &quot;Set&quot; on Target &quot;CN=CHI-SRV01, CN=Computers,DC=GLOBOMANTICS,DC=local&quot;. <\/code><\/pre>\n<p>  \u0418\u043b\u0438 \u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0432 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; get-adcomputer &quot;chi-srv01&quot; | Disable-ADAccount <\/code><\/pre>\n<p>  \u042f \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0433\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0439 \u043a\u043e\u0434, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u0435 \u0443\u0447\u0435\u0442\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u0432\u0441\u0435 \u0438\u0445 \u0434\u0435\u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c:<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; get-adcomputer -filter &quot;Passwordlastset -lt '1\/1\/2012'&quot; -properties *| Disable-ADAccount <\/code><\/pre>\n<h4>\u0417\u0430\u0434\u0430\u0447\u0430 10: \u041d\u0430\u0439\u0442\u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u044b \u043f\u043e \u0442\u0438\u043f\u0443<\/h4>\n<p>  \u041c\u043d\u0435 \u0442\u0430\u043a\u0436\u0435 \u0447\u0430\u0441\u0442\u043e \u0437\u0430\u0434\u0430\u044e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441, \u043a\u0430\u043a \u043d\u0430\u0439\u0442\u0438 \u0443\u0447\u0435\u0442\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u0432 \u043f\u043e \u0442\u0438\u043f\u0443, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0435\u0440\u0432\u0435\u0440\u044b \u0438\u043b\u0438 \u0440\u0430\u0431\u043e\u0447\u0438\u0435 \u0441\u0442\u0430\u043d\u0446\u0438\u0438. \u0421 \u0432\u0430\u0448\u0435\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u044d\u0442\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u043a\u0440\u0435\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438. \u0412 AD \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u0442\u0430\u043a\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043b\u0438\u0447\u0430\u043b\u043e \u0441\u0435\u0440\u0432\u0435\u0440 \u043e\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u0440\u0430\u0437\u0432\u0435 \u0447\u0442\u043e \u041e\u0421. \u0415\u0441\u043b\u0438 \u0412\u0430\u0448 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e\u0434 Windows Server 2008, \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0433\u043a\u0430 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439.<br \/>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u041e\u0421, \u0430 \u0437\u0430\u0442\u0435\u043c \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u043c \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044e \u0443\u0447\u0435\u0442\u043d\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043f\u043e \u0438\u043c\u0435\u044e\u0449\u0438\u043c\u0441\u044f \u041e\u0421.<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; Get-ADComputer -Filter * -Properties OperatingSystem | Select OperatingSystem -unique | Sort OperatingSystem <\/code><\/pre>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u044b \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 7.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/07b\/756\/849\/07b75684942bcfad1d49f78653dd5b86.jpg\"\/><br \/>  \u0420\u0438\u0441. 7. \u0418\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u041e\u0421<\/p>\n<p>  \u042f \u0445\u043e\u0447\u0443 \u043d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0442\u043e\u0438\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u0430\u044f \u041e\u0421:<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; Get-ADComputer -Filter &quot;OperatingSystem -like '*Server*'&quot; -properties OperatingSystem,OperatingSystem ServicePack | Select Name,Op* | format-list <\/code><\/pre>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 8.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/9bf\/48b\/594\/9bf48b594685febd6f9dafcff27b53ee.jpg\"\/><\/p>\n<p>  \u041a\u0430\u043a \u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442\u0430\u043c\u0438 AD Get, \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c\u0438 OU, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e. \u0412\u0441\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u043f\u043e\u043a\u0430\u0437\u0430\u043b, \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u0435 PowerShell \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440\u044b, \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 CSV \u0438\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0430 \u043f\u043e\u0447\u0442\u0443 HTML \u043e\u0442\u0447\u0435\u0442\u044b \u2013 \u0438 \u0432\u0441\u0435 \u044d\u0442\u043e \u0438\u0437 PowerShell! \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0412\u0430\u043c \u043d\u0435 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0438 \u0435\u0434\u0438\u043d\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0430. <br \/>  \u0412\u043e\u0442 \u0412\u0430\u043c \u0431\u043e\u043d\u0443\u0441: \u043e\u0442\u0447\u0435\u0442 \u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0435 \u043f\u0430\u0440\u043e\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f (user password-age report), \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0439 \u0432 HTML \u0444\u0430\u0439\u043b\u0435:<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; Get-ADUser -Filter &quot;Enabled -eq 'True' -AND PasswordNeverExpires -eq 'False'&quot; -Properties PasswordLastSet,PasswordNeverExpires,PasswordExpired | Select DistinguishedName,Name,pass*,@{Name=&quot;PasswordAge&quot;; Expression={(Get-Date)-$_.PasswordLastSet}} |sort PasswordAge -Descending | ConvertTo-Html -Title &quot;Password Age Report&quot; | Out-File c:\\Work\\pwage.htm <\/code><\/pre>\n<p>  \u0425\u043e\u0442\u044f \u044d\u0442\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0433\u043a\u0430 \u043f\u0443\u0433\u0430\u044e\u0449\u0438\u043c, \u043f\u0440\u0438 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u043c \u0437\u043d\u0430\u043d\u0438\u0438 PowerShell \u0438\u043c \u043b\u0435\u0433\u043a\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f. \u0418 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0441\u043e\u0432\u0435\u0442: \u043a\u0430\u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c <b>PasswordAge<\/b>. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a \u043c\u0435\u0436\u0434\u0443 \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0438\u043c \u0434\u043d\u0435\u043c \u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e\u043c PasswordLastSet. \u0417\u0430\u0442\u0435\u043c \u044f \u0441\u043e\u0440\u0442\u0438\u0440\u0443\u044e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0434\u043b\u044f \u043c\u043e\u0435\u0433\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430. \u041d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 9 \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u0432\u044b\u0445\u043e\u0434 \u0434\u043b\u044f \u043c\u043e\u0435\u0433\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0434\u043e\u043c\u0435\u043d\u0430.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/4c3\/770\/7bf\/4c37707bffd173bda977864cd0c63f74.jpg\"\/><br \/>  \u041a\u043e\u043d\u0435\u0446 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430.<\/p>\n<p>  \u0411\u043e\u043d\u0443\u0441: PowerShell \u0434\u043b\u044f \u0446\u0435\u043b\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \\\\ \u0421\u0442\u0430\u0442\u044c\u0438 \u043d\u0430 \u0425\u0430\u0431\u0440\u0435   <\/p>\n<ul>\n<li><a href=\"http:\/\/habrahabr.ru\/post\/160599\/\">\u0423\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u043e\u0431 \u0438\u0441\u0442\u0435\u0447\u0435\u043d\u0438\u0438 \u0441\u0440\u043e\u043a\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u0430\u0440\u043e\u043b\u044f \u0432 Active Directory \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 PowerShell<\/a><\/li>\n<li><a href=\"http:\/\/habrahabr.ru\/post\/150149\/\">\u0410\u0443\u0434\u0438\u0442 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0444\u0430\u0439\u043b\u0430\u043c \u0438 \u0437\u0430\u043f\u0438\u0441\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0432 \u043b\u043e\u0433-\u0444\u0430\u0439\u043b \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 Powershell <\/a><\/li>\n<li>\u0410\u0443\u0434\u0438\u0442 Active Directory \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 Powershell \u0441 \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u0435\u043c \u043e\u0431 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u0445. <a href=\"http:\/\/habrahabr.ru\/post\/147750\/\">\u0427\u0430\u0441\u0442\u044c 1<\/a> \u0438 <a href=\"http:\/\/habrahabr.ru\/post\/150122\/\">\u0427\u0430\u0441\u0442\u044c 2<\/a> <\/li>\n<li><a href=\"http:\/\/habrahabr.ru\/post\/138600\/\">\u041f\u043e\u0442\u0435\u0440\u044f\u043d\u043d\u0430\u044f \u0433\u0440\u0443\u043f\u043f\u0430. \u0412\u044b\u044f\u0441\u043d\u044f\u0435\u043c \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u00ab\u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0445\u00bb \u0433\u0440\u0443\u043f\u043f \u0432 AD<\/a> <\/li>\n<\/ul>\n<p>  \u0410 \u043a\u0430\u043a \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 PowerShell \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0432\u0430\u0448\u0443 \u0440\u0430\u0431\u043e\u0442\u0443?          \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/company\/netwrix\/blog\/160837\/\"> http:\/\/habrahabr.ru\/company\/netwrix\/blog\/160837\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">       <img decoding=\"async\" align=\"right\" src=\"http:\/\/habrastorage.org\/storage2\/eef\/1be\/c68\/eef1bec6878c24a31ad68b76ed06356e.jpg\"\/><a href=\"http:\/\/jdhitsolutions.com\/\">\u0414\u0436\u0435\u0444\u0444\u0435\u0440\u0438 \u0425\u0438\u043a\u0441 <\/a>\u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b <a href=\"http:\/\/www.windowsitpro.com\/article\/windows-powershell\/top-10-active-directory-tasks-solved-powershell-144567\">\u0441\u0442\u0430\u0442\u044c\u044e \u043d\u0430 Windows IT Pro<\/a>, \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u043d\u0443\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f PowerShell \u0434\u043b\u044f \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f AD. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430 \u0430\u0432\u0442\u043e\u0440 \u0440\u0435\u0448\u0438\u043b \u0432\u0437\u044f\u0442\u044c 10 \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f AD \u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0442\u043e, \u043a\u0430\u043a \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f PowerShell:  <\/p>\n<ol>\n<li>\u0421\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/li>\n<li>\u0410\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0434\u0435\u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0447\u0435\u0442\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438<\/li>\n<li>\u0420\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0447\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/li>\n<li>\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0443\u0447\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c<\/li>\n<li>\u041d\u0430\u0439\u0442\u0438 \u043f\u0443\u0441\u0442\u044b\u0435 \u0433\u0440\u0443\u043f\u043f\u044b<\/li>\n<li>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0432 \u0433\u0440\u0443\u043f\u043f\u0443<\/li>\n<li>\u0412\u044b\u0432\u0435\u0441\u0442\u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u0447\u043b\u0435\u043d\u043e\u0432 \u0433\u0440\u0443\u043f\u043f\u044b<\/li>\n<li>\u041d\u0430\u0439\u0442\u0438 \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u0435 \u0443\u0447\u0435\u0442\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u0432<\/li>\n<li>\u0414\u0435\u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0447\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430<\/li>\n<li>\u041d\u0430\u0439\u0442\u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u044b \u043f\u043e \u0442\u0438\u043f\u0443<\/li>\n<\/ol>\n<p>  \u041f\u043e\u043c\u0438\u043c\u043e \u044d\u0442\u043e\u0433\u043e \u0430\u0432\u0442\u043e\u0440 \u0432\u0435\u0434\u0435\u0442 \u0431\u043b\u043e\u0433 (\u043f\u043e PowerShell, \u043a\u043e\u043d\u0435\u0447\u043d\u043e), \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u2014 <a href=\"http:\/\/jdhitsolutions.com\/blog\/\">jdhitsolutions.com\/blog\/<\/a>. \u0410 \u0441\u0430\u043c\u043e\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0437 \u0435\u0433\u043e \u0442\u0432\u0438\u0442\u0442\u0435\u0440\u0430 <a href=\"http:\/\/twitter.com\/jeffhicks\">twitter.com\/jeffhicks<\/a>. <br \/>  \u0418\u0442\u0430\u043a, \u043d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043c \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u0442\u0430\u0442\u044c\u0438 \u201cTop 10 Active Directory Tasks Solved with PowerShell\u201d.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-160837","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/160837","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=160837"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/160837\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=160837"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=160837"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=160837"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}