{"id":169823,"date":"2013-02-18T16:22:02","date_gmt":"2013-02-18T12:22:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=169823"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=169823","title":{"rendered":"<span class=\"post_title\">\u0423\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043b\u0443\u0436\u0431\u0430\u043c\u0438 Windows \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PowerShell. \u0427\u0430\u0441\u0442\u044c 5. CIM-\u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442\u044b<\/span>"},"content":{"rendered":"<div class=\"content html_format\">       <img decoding=\"async\" align=\"right\" src=\"http:\/\/habrastorage.org\/storage2\/eef\/1be\/c68\/eef1bec6878c24a31ad68b76ed06356e.jpg\"\/><br \/>  \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u044b \u0441\u0442\u0430\u0442\u0435\u0439 \u043f\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u0441\u043b\u0443\u0436\u0431\u0430\u043c\u0438 Windows, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u0445\u043e\u0434\u044f\u0442 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 <a href=\"http:\/\/4sysops.com\/\">4sysops.com<\/a>. \u0412 <a href=\"http:\/\/habrahabr.ru\/company\/netwrix\/blog\/168773\/\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u043f\u043e\u0441\u0442\u0435<\/a> \u0431\u044b\u043b\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043e \u043a\u0430\u043a \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043b\u0443\u0436\u0431\u0430\u043c\u0438 Windows, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f WMI. \u041d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435 \u0441 PowerShell 3.0, \u0442\u043e \u0432\u0430\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043d\u043e\u0432\u044b\u0435 CIM-\u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442\u044b. \u0420\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0438\u043c\u0438 \u043f\u0440\u043e\u0449\u0435 \u2014 \u0438 \u0432 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u043c\u044b \u0443\u0437\u043d\u0430\u0435\u043c \u043f\u043e\u0447\u0435\u043c\u0443. <br \/>  \u0418\u0442\u0430\u043a, \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u0442\u0430\u0442\u044c\u0438 \u0441 \u043f\u043e\u0440\u0442\u0430\u043b\u0430 4sysops.com <a href=\"http:\/\/4sysops.com\/archives\/managing-services-the-powershell-way-part-7\/\">Managing Services the PowerShell way \u2013 Part 7<\/a><br \/>  <a name=\"habracut\"><\/a>   <\/p>\n<h4>\u041e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a \u0441\u043b\u0443\u0436\u0431 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e CIM \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442\u043e\u0432<\/h4>\n<p>  \u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u0432\u0430\u0436\u043d\u044b\u0445 \u043e\u0442\u043b\u0438\u0447\u0438\u0439 CIM-\u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043e\u0442 \u201c\u0447\u0438\u0441\u0442\u043e\u0433\u043e\u201d WMI \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e, \u0447\u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 (resultant object) \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u043e\u0432. \u0410 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0432\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u044c (invoke) \u043c\u0435\u0442\u043e\u0434, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <b>StopService()<\/b>. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442 <b>Invoke-CimMethod<\/b>. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f \u0441\u043b\u0443\u0436\u0431\u044b spooler \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435.<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; get-ciminstance win32_service -filter &quot;Name='spooler'&quot;  ProcessId        Name           StartMode       State          Status     ExitCode ---------        ----           ---------       -----          ------     -------- 0                Spooler        Manual          Stopped        OK         1077 \u041a\u0430\u043a \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 WMI, \u043f\u0440\u043e\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442 Invoke-CimMethod. PS C:\\&gt; get-ciminstance win32_service -filter &quot;Name='spooler'&quot; | Invoke-CimMethod  -Name StartService                                         ReturnValue PSComputerName                                       ----------- --------------                                              0 <\/code><\/pre>\n<p>  \u0420\u0430\u0431\u043e\u0442\u0430 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442\u0430 \u0432\u043e \u043c\u043d\u043e\u0433\u043e \u0441\u0445\u043e\u0434\u0430 \u0441 <b>Invoke-WmiMethod<\/b>. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0440\u0430\u0432\u043d\u043e\u0435 0, \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0443\u0441\u043f\u0435\u0445. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c <a href=\"http:\/\/habrahabr.ru\/company\/netwrix\/blog\/168773\/\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441<\/a>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435 \u0441\u043b\u0443\u0436\u0431\u044b \u0441 \u0430\u0432\u0442\u043e\u0441\u0442\u0430\u0440\u0442\u043e\u043c, \u043d\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0431\u044b\u043b\u0438 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u044b.<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; get-ciminstance win32_service -filter &quot;startmode='auto' and state&lt;&gt;'running'&quot; -computer $computers | Invoke-CimMethod -Name StartService \u2013WhatIf <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <b>$computers<\/b> \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0438\u0445 \u043d\u0430\u0441 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u0432. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 <b>-Whatif<\/b>.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/2a8\/3a1\/a24\/2a83a1a246ba0b7ac8b775cd8a848701.png\"\/><\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0432\u043d\u0435\u0441\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u043d\u043e \u0443\u0436\u0435 \u0431\u0435\u0437 <b>\u2013WhatIf<\/b>.<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; get-ciminstance win32_service -filter &quot;startmode='auto' and state&lt;&gt;'running'&quot; -computer $computers | Invoke-CimMethod -Name StartService <\/code><\/pre>\n<p>  \u041d\u0430 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u0438\u0434\u0435\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0443 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 chi-dc02 (ReturnValue \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 0). <\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/dc5\/f4b\/efb\/dc5f4befb16b4a57be11a0af40c7b715.png\"\/><\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u044f \u0434\u0435\u043b\u0430\u043b \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Invoke-WmiMethod. \u0421\u0435\u0439\u0447\u0430\u0441 \u044f \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u0432 PowerShell 3.0, \u0442\u0430\u043a \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043b\u0443\u0436\u0431\u044b, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u043b\u044f \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432.<\/p>\n<pre><code class=\"vbscript\">get-ciminstance win32_service -filter &quot;startmode='auto' and state&lt;&gt;'running'&quot;  -computer $computers |  foreach { $result = $_ | Invoke-CimMethod -Name StartService #create a custom object [pscustomobject]@{   Result=$Result.ReturnValue   Name=$_.Name   DisplayName=$_.Displayname   Computername=$Result.PSComputername  } } | Sort Computername,Name <\/code><\/pre>\n<p>  \u0421\u0442\u0430\u043b\u043e \u043f\u0440\u043e\u0449\u0435, \u043d\u0435 \u0442\u0430\u043a \u043b\u0438?<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/364\/14a\/920\/36414a920e2a1877229fdc607a4b3eff.png\"\/><\/p>\n<p>  \u041c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u0430\u0442\u0443 \u0438 \u0432\u0440\u0435\u043c\u044f. \u0427\u0442\u043e\u0431\u044b \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0448\u0438\u0431\u043a\u0438, \u0441\u043b\u0435\u0433\u043a\u0430 \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438.<\/p>\n<pre><code class=\"vbscript\">... | Sort Computername,Name | Where {$_.result -gt 0} Result                Name               DisplayName            Computername ------                ----               -----------            ------------ 7                     VMTools            VMware Tools Service   chi-dc02 2                     gpsvc              Group Policy Client    chi-win8-01 <\/code><\/pre>\n<h4>\u041c\u0435\u043d\u044f\u0435\u043c \u0440\u0435\u0436\u0438\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430 (StartMode)<\/h4>\n<p>  \u041f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0441\u043b\u0443\u0436\u0431\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, Startmode) \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0441\u0442\u043e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043d\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u043b\u0443\u0436\u0431\u0430 Remote Access Connection Manager \u0431\u044b\u043b\u0430 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u0430 \u0432 \u0441\u0435\u0442\u0438. \u0422\u0430\u043a \u0447\u0442\u043e \u044f \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0441\u044c \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0435\u0435 \u0432\u0435\u0437\u0434\u0435.<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; get-ciminstance win32_service -filter &quot;name='rasman'&quot; -comp $computers |  Invoke-CimMethod -methodname ChangeStartmode -Arguments @{startmode='Disabled'}                                        ReturnValue PSComputerName                                       ----------- --------------                                                 0 chi-win8-01                                                 0 chi-dc03                                                 0 chi-db01                                                 0 chi-ex01 <\/code><\/pre>\n<p>  \u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 <b>Invoke-WmiMethod<\/b> \u2013 \u0441\u043f\u0438\u0441\u043e\u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0441\u043b\u043e\u0432\u0430\u0440\u044f (dictionary object). \u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0434\u0435\u0441\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u043a\u043b\u044e\u0447\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <b>StartMode<\/b>. \u041b\u0443\u0447\u0448\u0435 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u0430 WMI \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438\u043c\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430. \u0412\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u043e\u0431\u0440\u0430\u0442\u0438\u043b \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b <b>\u2013MethodName<\/b> \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0433\u043e (\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0432\u0448\u0435\u0433\u043e\u0441\u044f \u0440\u0430\u043d\u0435\u0435) \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <b>\u2013Name<\/b>. \u2013Name \u2013 \u044d\u0442\u043e \u043d\u0435\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u2013MethodName.<\/p>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043b\u043e\u0432\u0430\u0440\u044f (dictionary object) \u0434\u043b\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430, \u043f\u0440\u043e\u0449\u0435 \u0438\u0437\u0432\u043b\u0435\u0447\u044c Change \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0441\u043b\u0443\u0436\u0431\u044b. \u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0434\u043b\u044f \u0441\u043b\u0443\u0436\u0431\u044b Spooler \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 ErrorControl \u0440\u0430\u0432\u043d\u044b\u043c Ignore. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0435\u0440\u043d\u0435\u043c \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 Normal, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0442\u0435\u043f\u0435\u0440\u044c CIM \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442\u044b.<\/p>\n<pre><code class=\"vbscript\">PS C:\\&gt; get-ciminstance win32_service -filter &quot;name='spooler'&quot; | Invoke-CimMethod  -MethodName Change -Arguments @{ErrorControl=1}                                        ReturnValue PSComputerName                                       ----------- --------------                                                 0 <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043f\u0440\u043e\u0449\u0435. \u041d\u0435 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u0435 ($Null) \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043c\u0435\u0442\u043e\u0434 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0438 \u0441 \u0434\u0435\u043b\u043e\u043c \u043f\u043e\u043a\u043e\u043d\u0447\u0435\u043d\u043e.<\/p>\n<h4>\u0418\u0442\u043e\u0433<\/h4>\n<p>  \u041f\u043e\u0447\u0435\u043c\u0443 \u0441\u0442\u043e\u0438\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c CIM \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442\u044b: \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 \u201c\u0434\u0440\u0443\u0436\u0435\u0441\u043a\u0438\u0435 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f\u201d \u0441 \u0444\u0430\u0439\u0440\u0432\u043e\u043b\u043e\u043c. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f PowerShell 3.0. \u0412\u0441\u0435, \u0447\u0442\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043b\u0443\u0436\u0431\u0430\u043c\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e WMI, \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e CIM \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442\u043e\u0432, \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043c\u0435\u043d\u044c\u0448\u0438\u0445 \u0443\u0441\u0438\u043b\u0438\u0439 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e.<\/p>\n<p>  \u042f \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0442\u043a\u043d\u0443\u043b\u0441\u044f \u043d\u0430 \u043e\u0434\u043d\u0443 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c CIM \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442\u043e\u0432. \u0412 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u0434\u043e\u043b\u0436\u0435\u043d \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c c PowerShell 3.0. \u042d\u0442\u043e \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0435 \u0432\u0441\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430. \u041d\u043e \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0444\u0438\u043b\u044c\u0442\u0440, \u043a\u0430\u043a \u044f \u0447\u0430\u0441\u0442\u043e \u0434\u0435\u043b\u0430\u044e \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u0442\u043e \u044f \u043c\u043e\u0433\u0443 \u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Get-CimInstance \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 PowerShell 2.0! \u042f \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u0432\u044b\u044f\u0441\u043d\u044f\u044e, \u043f\u043e\u0447\u0435\u043c\u0443 \u0442\u0430\u043a. \u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u044e, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435, \u0447\u0442\u043e \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c \u0432 \u043b\u0430\u0431\u043e\u0440\u0430\u0442\u043e\u0440\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u0435.<\/p>\n<p>  \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0443\u0447\u0435\u0442\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 (credentials), \u043f\u043e\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u0430 \u0441\u043b\u0443\u0436\u0431\u0430.        \t\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\/169823\/\"> http:\/\/habrahabr.ru\/company\/netwrix\/blog\/169823\/<\/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\"\/><br \/>  \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u044b \u0441\u0442\u0430\u0442\u0435\u0439 \u043f\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u0441\u043b\u0443\u0436\u0431\u0430\u043c\u0438 Windows, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u0445\u043e\u0434\u044f\u0442 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 <a href=\"http:\/\/4sysops.com\/\">4sysops.com<\/a>. \u0412 <a href=\"http:\/\/habrahabr.ru\/company\/netwrix\/blog\/168773\/\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u043f\u043e\u0441\u0442\u0435<\/a> \u0431\u044b\u043b\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043e \u043a\u0430\u043a \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043b\u0443\u0436\u0431\u0430\u043c\u0438 Windows, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f WMI. \u041d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435 \u0441 PowerShell 3.0, \u0442\u043e \u0432\u0430\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043d\u043e\u0432\u044b\u0435 CIM-\u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442\u044b. \u0420\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0438\u043c\u0438 \u043f\u0440\u043e\u0449\u0435 \u2014 \u0438 \u0432 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u043c\u044b \u0443\u0437\u043d\u0430\u0435\u043c \u043f\u043e\u0447\u0435\u043c\u0443. <br \/>  \u0418\u0442\u0430\u043a, \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u0442\u0430\u0442\u044c\u0438 \u0441 \u043f\u043e\u0440\u0442\u0430\u043b\u0430 4sysops.com <a href=\"http:\/\/4sysops.com\/archives\/managing-services-the-powershell-way-part-7\/\">Managing Services the PowerShell way \u2013 Part 7<\/a>  <\/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-169823","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/169823","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=169823"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/169823\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=169823"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=169823"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=169823"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}