{"id":161533,"date":"2012-12-06T11:48:03","date_gmt":"2012-12-06T07:48:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=161533"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=161533","title":{"rendered":"<span class=\"post_title\">\u0421\u0442\u0440\u043e\u0438\u043c \u043e\u0442\u0447\u0435\u0442\u044b \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0435 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PowerShell<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" align=\"right\" src=\"http:\/\/habrastorage.org\/storage2\/eef\/1be\/c68\/eef1bec6878c24a31ad68b76ed06356e.jpg\"\/>\u0422\u0435\u043c\u0430 \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 \u043a\u0440\u0430\u0439\u043d\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0430, \u0438 \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0441\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u0442\u0430\u0442\u0435\u0439 \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443. \u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 <a href=\"http:\/\/habrahabr.ru\/company\/netwrix\/blog\/160837\/\">\u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u0442\u0430\u0442\u044c\u0438 <\/a>\u0414\u0436\u0435\u0444\u0444\u0440\u0438 \u0425\u0438\u043a\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043b\u0438 \u0432 \u043f\u0440\u043e\u0448\u043b\u0443\u044e \u043f\u044f\u0442\u043d\u0438\u0446\u0443, \u0432\u044b\u0437\u0432\u0430\u043b \u0432\u043e\u043b\u043d\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0430. \u0418 \u043a\u0430\u043a \u0442\u0443\u0442 \u043d\u0435 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u044b\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435 \u0442\u043e\u0433\u043e \u0436\u0435 \u0430\u0432\u0442\u043e\u0440\u0430 \u043d\u0430 TechEd North America 2012. \u0414\u043e\u043a\u043b\u0430\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0414\u0436\u0435\u0444\u0444\u0440\u0438 \u0425\u0438\u043a\u0441 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0414\u0436\u0435\u0440\u0435\u043c\u0438 \u041c\u043e\u0441\u043a\u043e\u0432\u0438\u0446\u0435\u043c (Jeremy Moskowitz), \u0431\u044b\u043b \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d \u0430\u043d\u0430\u043b\u0438\u0437\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u0438\u0442\u0438\u043a \u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u043e\u0442\u0447\u0435\u0442\u043e\u0432. \u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b (\u0432\u0438\u0434\u0435\u043e) <a href=\"http:\/\/channel9.msdn.com\/Events\/TechEd\/NorthAmerica\/2012\/WSV415\">\u0437\u0434\u0435\u0441\u044c<\/a>, \u043c\u044b \u0436\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043c \u043a\u0440\u0430\u043a\u0442\u043a\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 + \u0441\u043a\u0440\u0438\u043f\u0442\u044b. \u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u0430\u043c\u043e \u0432\u0438\u0434\u0435\u043e.<\/p>\n<p>  \u0412 \u0444\u043e\u043a\u0443\u0441\u0435 \u0434\u043e\u043a\u043b\u0430\u0434\u0430 \u0431\u044b\u043b\u043e \u0434\u0432\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u0430:  <\/p>\n<ol>\n<li>\u0421\u0442\u0440\u043e\u0438\u0442 \u043e\u0442\u0447\u0435\u0442\u044b \u043f\u043e \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u043c \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0430\u043c<\/li>\n<li>\u041f\u0440\u043e\u0432\u043e\u0434\u0438\u043c \u0430\u043d\u0430\u043b\u0438\u0437 \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u0438\u0442\u0438\u043a<\/li>\n<\/ol>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u2013 \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c.<br \/>  <a name=\"habracut\"><\/a><\/p>\n<h4>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c PowerShell \u0432 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441 \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u043c\u0438 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0430\u043c\u0438: \u0447\u0442\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e?<\/h4>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c PowerShell \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u043c\u0438 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0430\u043c\u0438, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b:  <\/p>\n<ul>\n<li>Windows 7 (\u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 PowerShell)<\/li>\n<li><a href=\"http:\/\/www.microsoft.com\/ru-ru\/download\/details.aspx?id=7887\">RSAT \u0434\u043b\u044f Windows 7<\/a><\/li>\n<li>\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u0430\u043c PowerShell v2.0 \u0438\u043b\u0438 \u0432\u044b\u0448\u0435<\/li>\n<li>\u041e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e: \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f <a href=\"http:\/\/msdn.microsoft.com\/ru-ru\/library\/windows\/desktop\/aa384753(v=vs.85).aspx\">Microsoft Active Directory Provider<\/a><\/li>\n<\/ul>\n<p>  \u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0448\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439:<\/p>\n<ul>\n<li>\u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u0438\u0442\u0438\u043a (Import-module GroupPolicy)<\/li>\n<li>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u0438\u0442\u0438\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PowerShell (Get a GPO PowerShell Object)<\/li>\n<li>\u0421\u0442\u0440\u043e\u0438\u043c \u043e\u0442\u0447\u0435\u0442 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u044d\u0442\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430<\/li>\n<li>\u0421\u0442\u0440\u043e\u0438\u043c HTML\/XML-\u043e\u0442\u0447\u0435\u0442\u044b \u043f\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u0438\u0442\u0438\u043a<\/li>\n<li>\u041f\u0430\u0440\u0441\u0438\u043c \u0438 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u0438\u0441\u043a \u0432 XML \u0434\u043b\u044f \u0446\u0435\u043b\u0435\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430<\/li>\n<li>\u041e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u0438\u0441\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Select-XML \u0438 Xpath<\/li>\n<\/ul>\n<h4>\u0421\u0442\u0440\u043e\u0438\u043c \u043e\u0442\u0447\u0435\u0442\u044b \u043f\u043e \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u043c \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0430\u043c<\/h4>\n<p>  <b>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u21161. \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0432 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0430\u0445<br \/>  <\/b><\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; Import-Module GroupPolicy PS C:\\&gt; Get-GPO JeremyGPO  <\/code><\/pre>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u043c\u0435\u0441\u0442\u043e JeremyGPO \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c\u043e\u0435 \u0438\u043c\u044f (DisplayName) \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u0438\u0442\u0438\u043a. \u0412\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0442\u0430\u043a\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0447\u043a\u0430<\/p>\n<pre><code class=\"vbscript\">DisplayName      : JeremyGPO DomainName       : GLOBOMANTICS.local Owner            : GLOBOMANTICS\\Domain Admins Id               : cd73c562-5bfe-40e2-b81e-28da10da425c GpoStatus        : ComputerSettingsDisabled Description      : CreationTime     : 12\/28\/2011 2:52:37 PM ModificationTime : 5\/21\/2012 11:08:26 AM UserVersion      : AD Version: 4, SysVol Version: 4 ComputerVersion  : AD Version: 1, SysVol Version: 1 WmiFilter        : <\/code><\/pre>\n<p>  <b>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b: \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0442\u0447\u0435\u0442\u044b. <\/b><\/p>\n<p>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u044b \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 30 \u0434\u043d\u0435\u0439, \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u0443\u0431\u044b\u0432\u0430\u043d\u0438\u044e (\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043d\u0430\u0432\u0435\u0440\u0445\u0443) \u0441 \u0442\u0440\u0435\u043c\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 (\u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c\u043e\u0435 \u0438\u043c\u044f, \u0432\u0440\u0435\u043c\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435). \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 .csv \u0444\u0430\u0439\u043b (GPOModReport.csv \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435). \u041a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 PowerShell:<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; get-gpo -all | Where {$_.ModificationTime -gt (Get-Date).AddDays(-30)}  ... | Sort ModificationTime -Descending | Where {$_.ModificationTime -ge (Get-Date).AddDays(-30)} | Select Displayname,ModificationTime,Description  ... | Export-CSV R:\\GPOModReport.csv <\/code><\/pre>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"vbscript\">#\u0421\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u0438\u0442\u0438\u043a PS C:\\&gt;get-gpo -all | Sort CreationTime,Modificationtime | Select Displayname,*Time <\/code><\/pre>\n<pre><code class=\"vbscript\">#\u041d\u0430\u0445\u043e\u0434\u0438\u043c \u0432\u0441\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u0438\u0442\u0438\u043a, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u044b\u0435 \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 30 \u0434\u043d\u0435\u0439  PS C:\\&gt;get-gpo -all | Where {$_.ModificationTime -ge (Get-Date).AddDays(-30)} <\/code><\/pre>\n<pre><code class=\"vbscript\">#\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0442\u0447\u0435\u0442 \u043f\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0443 \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u0438\u0442\u0438\u043a (Defaul Domain Policy) PS C:\\&gt;Get-GPOReport -name &quot;Default Domain Policy&quot; -ReportType HTML -Path &quot;c:\\work\\ddp.htm&quot; invoke-item &quot;c:\\work\\ddp.htm&quot; <\/code><\/pre>\n<pre><code class=\"vbscript\">#\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0442\u0447\u0435\u0442\u044b \u043f\u043e \u0432\u0441\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u0438\u0442\u0438\u043a PS C:\\&gt;Get-GPOReport -All -ReportType HTML -Path &quot;c:\\work\\allgpo.htm&quot; invoke-item &quot;c:\\work\\allgpo.htm&quot; <\/code><\/pre>\n<pre><code class=\"vbscript\">#\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u0438\u0442\u0438\u043a \u0441\u0432\u043e\u0439 \u043e\u0442\u0447\u0435\u0442 #\u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u043f\u0440\u043e\u0431\u0435\u043b\u044b \u043d\u0430 _ \u0432 \u0438\u043c\u0435\u043d\u0438 GPO PS C:\\&gt;Get-GPO -all | foreach {   $f=&quot;{0}.htm&quot; -f ($_.Displayname).Replace(&quot; &quot;,&quot;_&quot;)  $htmfile=Join-Path -Path &quot;C:\\work&quot; -ChildPath $f  Get-GPOReport -Name $_.Displayname -ReportType HTML -Path $htmfile  Get-Item $htmfile  } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <b>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u21162. \u0421\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e GPO, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f.<br \/>  <\/b><\/p>\n<p>  <b>\u0417\u0430\u0434\u0430\u0447\u0430: \u043d\u0430\u0439\u0442\u0438 \u043f\u0443\u0441\u0442\u044b\u0435 GPOs<br \/>  <\/b><\/p>\n<ul>\n<li>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u0438\u0442\u0438\u043a \u0431\u0435\u0437 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a<\/li>\n<li>\u0418\u0449\u0435\u043c XML ExtensionData<\/li>\n<\/ul>\n<pre><code class=\"vbscript\">PS C:\\&gt; Import-Module GroupPolicy PS C:\\&gt; [xml]$r = Get-GPOReport -Name MyGPO  -ReportType XML PS C:\\&gt; if ((-Not $r.gpo.user.extensiondata) -AND (-not $r.gpo.computer.extensiondata)) {  &quot;GPO is empty&quot;  } <\/code><\/pre>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"vbscript\">#requires -version 2.0  #find empty gpos in the domain  Function Get-EmptyGPO {  Param ( [Parameter(Position=0,ValueFromPipeline=$True, ValueFromPipelinebyPropertyName=$True)] [string]$DisplayName )  Begin { #import the GroupPolicy Module Import-Module GroupPolicy  }  Process { #create an XML report [xml]$report=Get-GPOReport -Name $displayname -ReportType XML   #totally empty  if ((-Not $report.gpo.user.extensiondata) -AND (-not $report.gpo.computer.extensiondata)) {     #no extension data so write     Get-GPO -Name $Displayname }  } #process  End {}  } #function  Function Test-EmptyGPO {  Param ( [Parameter(Position=0,ValueFromPipeline=$True, ValueFromPipelinebyPropertyName=$True)] [string]$DisplayName )  Begin { #import the GroupPolicy Module Import-Module GroupPolicy  }  Process {      #set default values     $User=$False     $Computer=$False     #create an XML report     [xml]$report=Get-GPOReport -Name $displayname -ReportType XML      if ($report.gpo.user.extensiondata) {      $User=$True     }     If ( $report.gpo.computer.extensiondata) {      $Computer=$True     }     #write a custom object to the pipeline     New-Object -TypeName PSObject -Property @{     Displayname=$report.gpo.name     UserData=$User     ComputerData=$Computer     }  } #Process  End {}  } #function  #Get-GPO -All | Get-EmptyGPO #Get-GPO -All | Test-EmptyGPO <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <b>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u21163.<br \/>  <\/b>\u041a\u0442\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u043b\u0441\u044f \u043a \u043e\u0431\u044a\u0435\u043a\u0442\u0443 \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u043e\u0439 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0438?<br \/>  \u0418\u043c\u0435\u044e\u0442\u0441\u044f \u043b\u0438 GPO, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0438 \u0434\u0435\u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0430 (\u201cAre there any GPOs with \u2018half\u2019 the policy disabled?\u201d)<br \/>  \u0418\u043c\u0435\u044e\u0442\u0441\u044f \u043b\u0438 GPO, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u0441\u0435 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0438 \u0434\u0435\u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u044b (\u201cAre there any GPOs with \u2018all\u2019 the policy disabled?\u201d)<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0444\u0438\u043b\u044c\u0442\u0440 \u043f\u043e \u0441\u0442\u0430\u0442\u0443\u0441\u0443 GPO (GPOStatus). \u041a\u0430\u0436\u0434\u043e\u043c\u0443 \u0438\u0437 \u0442\u0440\u0435\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0432\u044b\u0448\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0442\u0440\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; get-gpo -all | Sort GPOStatus | format-table -GroupBy GPOStatus Displayname,*Time PS C:\\&gt; get-gpo -all | where {$_.GPOStatus -match &quot;disabled&quot;} | Select GPOStatus,Displayname PS C:\\&gt; get-gpo -all | where {$_.GPOStatus -match &quot;AllSettingsDisabled&quot;} <\/code><\/pre>\n<h4>\u0410\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u0438\u0442\u0438\u043a<\/h4>\n<p>  <b>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u21164. \u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u043c GPO \u0431\u0435\u0437 \u0441\u0432\u044f\u0437\u0435\u0439<br \/>  <\/b><\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; Import-Module ActiveDirectory Get-ADOrganizationalUnit -filter * | select-object -ExpandProperty DistinguishedName | get-adobject  -prop gplink | where {$_.gplink} | Select-object  -expand gplink | foreach-object {  foreach ($item in ($_.Split(&quot;][&quot;))) { $links+=$regex.match($item).Value    }  }  Get-GPO -All | Where {$links -notcontains $_.id}  <\/code><\/pre>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"vbscript\">#requires -version 2.0  &lt;#  Find unlinked GPOs. This requires the Active Directory Module  This version does not query for site links  #&gt;  Import-Module ActiveDirectory,GroupPolicy  #GUID regular expression pattern [Regex]$RegEx = &quot;(([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12})&quot;  #create an array of distinguishednames $dn=@() $dn+=Get-ADDomain | select -ExpandProperty DistinguishedName $dn+=Get-ADOrganizationalUnit -filter * | select -ExpandProperty DistinguishedName  $links=@()  #get domain and OU links      foreach ($container in $dn) {      #pull the GUID and add it to the array of links      get-adobject -identity $container -prop gplink |      where {$_.gplink} | Select -expand gplink | foreach {              #there might be multiple GPO links so split                     foreach ($item in ($_.Split(&quot;][&quot;))) {         $links+=$regex.match($item).Value       } #foreach item     } #foreach } #foreach container  #$links  &lt;#  get all gpos where the ID doesn't belong to the array  write the GPO to the pipeline #&gt;  Get-GPO -All | Where {$links -notcontains $_.id}  <\/code><\/pre>\n<\/p><\/div>\n<\/div>\n<p>  <b>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 5. \u041e\u0431\u044a\u0435\u043a\u0442\u044b \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u0438\u0442\u0438\u043a \u0441 \u0438\u0437\u043b\u0438\u0448\u043d\u0438\u043c\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438 \u0432 \u0440\u0435\u0435\u0441\u0442\u0440\u0435 (\u201cExtra Registry Settings\u201d)<\/b><\/p>\n<p>  \u041d\u0430\u0445\u043e\u0434\u0438\u043c \u0438\u0437\u043b\u0438\u0448\u043d\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432 \u0440\u0435\u0435\u0441\u0442\u0440\u0435   <\/p>\n<pre><code class=\"vbscript\">#Use Xpath with the XML report data PS C:\\&gt; [xml]$report = Get-GPOReport -Name MyGPO  -ReportType XML PS C:\\&gt; $ns = @{q3 = &quot;http:\/\/www.microsoft.com\/GroupPolicy\/Settings\/Registry&quot;} PS C:\\&gt; $nodes = Select-Xml -Xml $report -Namespace $ns -XPath &quot;\/\/q3:RegistrySetting&quot; | select -expand Node | Where {$_.AdmSetting -eq 'false'}  <\/code><\/pre>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"vbscript\">#requires -version 2.0  #find GPOs with extra registry, ie non-ADM settings  Function Test-GPOExtraRegistry {  Param ( [Parameter(Position=0,ValueFromPipeline=$True, ValueFromPipelinebyPropertyName=$True)] [string]$DisplayName )  Begin {     #import the GroupPolicy Module     Import-Module GroupPolicy }  Process { #create an XML report [xml]$report=Get-GPOReport -Name $displayname -ReportType XML #define the XML namespace $ns=@{q3=&quot;http:\/\/www.microsoft.com\/GroupPolicy\/Settings\/Registry&quot;} $nodes=Select-Xml -Xml $report -Namespace $ns -XPath &quot;\/\/q3:RegistrySetting&quot; |  select -expand Node | Where {$_.AdmSetting -eq 'false'}  if ($nodes) {   #extra settings were found so get the GPO and write it to the pipeline   Get-GPO -Name $Displayname }  }  End {}  } #function  #Import-Module GroupPolicy #Get-GPO -all | Test-GPOExtraRegistry  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0415\u0449\u0435 \u0440\u0430\u0437 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u043f\u0440\u0438\u0432\u0435\u043b\u0438 \u0432 \u043f\u043e\u0441\u0442\u0435 \u043b\u0438\u0448\u044c \u0441\u0443\u0445\u043e\u0439 \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u0432 \u0434\u043e\u043a\u043b\u0430\u0434\u0435. \u0421\u0430\u043c \u0434\u043e\u043a\u043b\u0430\u0434 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"http:\/\/channel9.msdn.com\/Events\/TechEd\/NorthAmerica\/2012\/WSV415\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>  \u0411\u043e\u043d\u0443\u0441\u044b:  <\/p>\n<ul>\n<li><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/06\/TechEd2012-GPOAnalysis-PowerShellDemo.zip\">\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u044b<\/a><\/li>\n<li><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/06\/GroupPolicy_Reporting_Analysis_with_PowerShell.pdf\">\u0421\u043b\u0430\u0439\u0434\u044b<\/a><\/li>\n<li><a href=\"https:\/\/moskowitzinc.infusionsoft.com\/app\/form\/2fb14a6883b8b10595a174b65169af71\">\u0411\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u0430\u044f \u043a\u043d\u0438\u0433\u0430 \u043f\u043e Group Policy + PowerShell \u043e\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u0430\u0432\u0442\u043e\u0440\u043e\u0432 \u0434\u043e\u043a\u043b\u0430\u0434\u0430 [ENG]<\/a> (\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0444\u043e\u0440\u043c\u0443)<\/li>\n<\/ul>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043e\u0442\u0447\u0435\u0442\u043e\u0432 \u043f\u043e \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u043c \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0430\u043c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u0448\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 <a href=\"http:\/\/www.netwrix.com\/ru\/group_policy_auditing_change_reporting_freeware.html\">NetWrix Group Policy Change Reporter<\/a>.    \t   \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\/161533\/\"> http:\/\/habrahabr.ru\/company\/netwrix\/blog\/161533\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" align=\"right\" src=\"http:\/\/habrastorage.org\/storage2\/eef\/1be\/c68\/eef1bec6878c24a31ad68b76ed06356e.jpg\"\/>\u0422\u0435\u043c\u0430 \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 \u043a\u0440\u0430\u0439\u043d\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0430, \u0438 \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0441\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u0442\u0430\u0442\u0435\u0439 \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443. \u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 <a href=\"http:\/\/habrahabr.ru\/company\/netwrix\/blog\/160837\/\">\u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u0442\u0430\u0442\u044c\u0438 <\/a>\u0414\u0436\u0435\u0444\u0444\u0440\u0438 \u0425\u0438\u043a\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043b\u0438 \u0432 \u043f\u0440\u043e\u0448\u043b\u0443\u044e \u043f\u044f\u0442\u043d\u0438\u0446\u0443, \u0432\u044b\u0437\u0432\u0430\u043b \u0432\u043e\u043b\u043d\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0430. \u0418 \u043a\u0430\u043a \u0442\u0443\u0442 \u043d\u0435 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u044b\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435 \u0442\u043e\u0433\u043e \u0436\u0435 \u0430\u0432\u0442\u043e\u0440\u0430 \u043d\u0430 TechEd North America 2012. \u0414\u043e\u043a\u043b\u0430\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0414\u0436\u0435\u0444\u0444\u0440\u0438 \u0425\u0438\u043a\u0441 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0414\u0436\u0435\u0440\u0435\u043c\u0438 \u041c\u043e\u0441\u043a\u043e\u0432\u0438\u0446\u0435\u043c (Jeremy Moskowitz), \u0431\u044b\u043b \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d \u0430\u043d\u0430\u043b\u0438\u0437\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u0438\u0442\u0438\u043a \u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u043e\u0442\u0447\u0435\u0442\u043e\u0432. \u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b (\u0432\u0438\u0434\u0435\u043e) <a href=\"http:\/\/channel9.msdn.com\/Events\/TechEd\/NorthAmerica\/2012\/WSV415\">\u0437\u0434\u0435\u0441\u044c<\/a>, \u043c\u044b \u0436\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043c \u043a\u0440\u0430\u043a\u0442\u043a\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 + \u0441\u043a\u0440\u0438\u043f\u0442\u044b. \u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u0430\u043c\u043e \u0432\u0438\u0434\u0435\u043e.<\/p>\n<p>  \u0412 \u0444\u043e\u043a\u0443\u0441\u0435 \u0434\u043e\u043a\u043b\u0430\u0434\u0430 \u0431\u044b\u043b\u043e \u0434\u0432\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u0430:  <\/p>\n<ol>\n<li>\u0421\u0442\u0440\u043e\u0438\u0442 \u043e\u0442\u0447\u0435\u0442\u044b \u043f\u043e \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u043c \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0430\u043c<\/li>\n<li>\u041f\u0440\u043e\u0432\u043e\u0434\u0438\u043c \u0430\u043d\u0430\u043b\u0438\u0437 \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u0438\u0442\u0438\u043a<\/li>\n<\/ol>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u2013 \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c.  <\/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-161533","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/161533","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=161533"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/161533\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=161533"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=161533"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=161533"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}