{"id":296967,"date":"2020-01-10T15:00:32","date_gmt":"2020-01-10T15:00:32","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=296967"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=296967","title":{"rendered":"\u041f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Powershell"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/ultravds\/blog\/483416\/\"><a href=\"https:\/\/habr.com\/ru\/company\/ultravds\/blog\/483416\/\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/9e6\/17e\/c95\/9e617ec959b5c01c569bd9d6a8b1cf8a.png\" width=\"500\"><\/div>\n<p><\/a><br \/>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u043e\u0447\u0435\u043c\u0443 \u043c\u044b \u0432\u0441\u0435 \u043b\u044e\u0431\u0438\u043c Powershell \u043d\u0430 \u043f\u0430\u0440\u0435 \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432. \u0412\u0441\u0435 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u043f\u0440\u0438 \u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u043f\u043e\u0438\u0441\u043a\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \u0438 \u043f\u0440\u043e\u0447\u0438\u0445 \u0434\u0435\u043b\u0430\u0445. Powershell \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d \u0443\u0434\u043e\u0431\u043d\u044b\u043c\u0438 \u0438 \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u044e\u0449\u0438\u043c\u0438\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442\u0430\u043c\u0438, \u0430\u0432\u0442\u043e\u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0433\u043e \u0438 \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u044b\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0434\u0435\u043b\u0430\u044e\u0442 \u0435\u0433\u043e \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u0441\u0430\u043c\u044b\u043c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0432 \u043e\u0441\u0432\u043e\u0435\u043d\u0438\u0438 \u044f\u0437\u044b\u043a\u043e\u043c.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u0440\u0443\u0442\u044b\u0445 \u043f\u043e \u043c\u043d\u0435\u043d\u0438\u044e \u0430\u0432\u0442\u043e\u0440\u0430 \u043a\u043e\u043c\u0430\u043d\u0434 \u0438 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0435\u043c \u043f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u043a\u0440\u0443\u0442\u043e. \u041d\u0430\u0447\u043d\u0435\u043c \u0441\u043e \u0441\u043d\u0438\u043f\u0435\u0442\u043e\u0432.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u043d\u0438\u043f\u0435\u0442\u044b:<\/h2>\n<p>  <b>\u0417\u0430\u043d\u043e\u0441\u0438\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u0432 TrustedHosts<\/b><\/p>\n<p>  \u041f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u043f\u043e WinRm. \u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0448\u0435\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0431\u0443\u0434\u044c\u0442\u0435 \u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u044b, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0439\u0442\u0435 ip \u0438\u043b\u0438 \u0438\u043c\u0435\u043d\u0430 \u0445\u043e\u0441\u0442\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u043f\u044f\u0442\u0443\u044e. \u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u0432\u0430\u0448\u0438 \u0445\u043e\u0441\u0442\u044b \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 AD, \u0442\u0440\u043e\u0433\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u043d\u0435 \u043d\u0443\u0436\u043d\u043e.<\/p>\n<pre><code class=\"powershell\">Set-Item\u00a0WSMan:\\localhost\\Client\\TrustedHosts\u00a0-Value\u00a0'192.168.0.1'<\/code><\/pre>\n<p>  Wildcard \u0442\u043e\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0445\u043e\u0442\u0438\u0442\u0435 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0445\u043e\u0441\u0442 \u0432 TrustedHosts.<\/p>\n<pre><code class=\"powershell\">Set-Item\u00a0WSMan:\\localhost\\Client\\TrustedHosts\u00a0-Value\u00a0'*'<\/code><\/pre>\n<p>  <b>\u0425\u0440\u0430\u043d\u0438\u043c \u043f\u0430\u0440\u043e\u043b\u044c \u0432 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u0432 \u0444\u0430\u0439\u043b\u0435:<\/b><\/p>\n<p>  \u041f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438, \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u0435\u0442 \u0436\u0438\u0437\u043d\u044c \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0438\u0437 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0430\u0440\u043e\u043b\u044c \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u043c \u0432\u0438\u0434\u0435.\u00a0<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0438\u0437 \u043f\u043e\u0434 \u0437\u0430\u0448\u0435\u0434\u0448\u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u0440\u0435\u0434\u044b \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<pre><code class=\"powershell\">Read-Host -AsSecureString |\u00a0ConvertTo-SecureString\u00a0-AsPlainText\u00a0-Force\u00a0|\u00a0ConvertFrom-SecureString\u00a0|\u00a0Out-File\u00a0-FilePath\u00a0.\\Password.txt<\/code><\/pre>\n<p>  \u0417\u0430\u0431\u0438\u0440\u0430\u0435\u043c \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c \u0438\u0437 \u0444\u0430\u0439\u043b\u0430:<\/p>\n<pre><code class=\"powershell\">$Password\u00a0=\u00a0Get-Content\u00a0C:\\Password.txt\u00a0|\u00a0ConvertTo-SecureString<\/code><\/pre>\n<p>  \u0422\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u0442\u044c \u0438 \u0441 Credentials, \u0437\u0430\u043c\u0435\u043d\u0438\u043c Read-Host \u043d\u0430 Get-Credential.<\/p>\n<pre><code class=\"powershell\">Get-Credential\u00a0|\u00a0ConvertTo-SecureString\u00a0-AsPlainText\u00a0-Force\u00a0|\u00a0ConvertFrom-SecureString\u00a0|\u00a0Out-File\u00a0-FilePath\u00a0.\\Credential.txt<\/code><\/pre>\n<p>  <b>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u0442\u0443 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u041e\u0421.<\/b><\/p>\n<pre><code class=\"powershell\">(gcim\u00a0win32_operatingsystem).LastBootUpTime<\/code><\/pre>\n<p>  \u0422\u0435\u043c \u0436\u0435 \u0441\u0430\u043c\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0435\u0449\u0435 \u0438 \u0430\u043f\u0442\u0430\u0439\u043c.<\/p>\n<pre><code class=\"powershell\">Get-CimInstance\u00a0Win32_operatingsystem\u00a0-ComputerName\u00a0$computers\u00a0| Select-Object\u00a0LastBootUpTime, @{Name=\"Uptime\";Expression\u00a0=\u00a0{(Get-Date)\u00a0-\u00a0$_.LastBootUptime}}\u00a0<\/code><\/pre>\n<p>  <b>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c:<\/b><\/p>\n<p>  \u0418\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c, \u0430 \u043d\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432:<\/p>\n<pre><code class=\"powershell\">gcim\u00a0win32_product\u00a0-computername\u00a0$env:computername\u00a0|\u00a0Sort-Object\u00a0-property\u00a0Vendor,Name\u00a0|\u00a0Select-Object\u00a0-property\u00a0Vendor,Name,\u00a0Caption<\/code><\/pre>\n<p>  \u0422\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0440\u0435\u0437 \u0440\u0435\u0435\u0441\u0442\u0440:<\/p>\n<pre><code class=\"powershell\"> Get-ItemProperty HKLM:\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\* |  Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table \u2013AutoSize <\/code><\/pre>\n<p>  <b>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u0438\u0441\u043a\u043e\u0432, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0438 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u043d\u0430 \u043d\u0438\u0445<\/b><\/p>\n<pre><code class=\"powershell\">Get-PSDrive\u00a0-PSProvider\u00a0filesystem\u00a0|\u00a0where-object\u00a0{$_.used\u00a0-gt\u00a00}\u00a0| Select-Object\u00a0-property\u00a0Root,@{name=\"Size\";expression={($_.used+$_.free)\/1GB\u00a0-as\u00a0[int]}}, @{name=\"Used\";expression={($_.used\/1GB)\u00a0-as\u00a0[int]}}, @{name=\"Free\";expression={($_.free\/1GB)\u00a0-as\u00a0[int]}}\u00a0<\/code><\/pre>\n<p>  <b>\u041e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e \u0435\u0433\u043e \u0438\u043c\u0435\u043d\u0438.<\/b><\/p>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c Chrome. Wildcard \u0442\u043e\u0436\u0435 \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0432\u0441\u0451.<\/p>\n<pre><code class=\"powershell\">Get-Process\u00a0-Name\u00a0\"chrome\"\u00a0|\u00a0Stop-Process<\/code><\/pre>\n<p>  <b>\u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043f\u0430\u043f\u043a\u0430\u043c \u043d\u0430 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0435 \u043f\u0430\u043f\u043a\u0438<\/b><\/p>\n<p>  \u041f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u0437\u0430\u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0442\u044c \u0438\u043b\u0438 \u0434\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a \u043f\u0430\u043f\u043a\u0435 \u0438 \u0432\u0441\u0435\u043c \u043f\u043e\u0434\u043f\u0430\u043f\u043a\u0430\u043c \u0443 \u0433\u0440\u0443\u043f\u043f\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438\u043b\u0438 \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e, \u0441\u043d\u0438\u0437\u0443 \u0432\u0432\u0435\u0440\u0445 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442 \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0438\u0441\u044c.<\/p>\n<p>  \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c ACL \u0443 \u043f\u0430\u043f\u043a\u0438:<\/p>\n<pre><code class=\"powershell\">$Acl = Get-Acl\u00a0-Path\u00a0C:\\folder\\<\/code><\/pre>\n<p>  \u0412\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c ACL \u043d\u0430 \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b \u0438 \u043f\u043e\u0434\u043f\u0430\u043f\u043a\u0438:<\/p>\n<pre><code class=\"powershell\">Get-ChildItem\u00a0-Path\u00a0C:\\Folder\\\u00a0-Recurse\u00a0|\u00a0Set-Acl\u00a0$Acl\u00a0<\/code><\/pre>\n<p>  <\/p>\n<h2>\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u044b:<\/h2>\n<p>  \u0412\u043e\u0442 \u0442\u0443\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u043e\u0435 \u0441\u0442\u0440\u0430\u0448\u043d\u043e\u0435 \u0432\u0435\u0441\u0435\u043b\u044c\u0435. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u0438\u0437\u0430\u0446\u0438\u044e, \u0431\u0443\u0434\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0433\u043b\u044f\u043d\u0443\u0442\u044c. \u0415\u0441\u043b\u0438 \u0432\u0430\u0448\u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u044b \u043d\u0435 \u0432 AD, \u0442\u043e \u0441\u043a\u0440\u0438\u043f\u0442 \u0441\u0442\u0430\u043d\u0435\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u0438\u0442\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u043e \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u0444\u0430\u0439\u043b\u0443, \u0430 \u043f\u0430\u0440\u043e\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0431\u0440\u0430\u0442\u044c \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 \u0438\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 Get-Credential. \u0412\u0441\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430:<\/p>\n<p>  C AD:<\/p>\n<pre><code class=\"powershell\">$ADComputers\u00a0=\u00a0(Get-ADComputer\u00a0-filter\u00a0*).DNSHostName<\/code><\/pre>\n<p>  \u0411\u0435\u0437 AD:<\/p>\n<pre><code class=\"powershell\">$Credentials\u00a0=\u00a0Get-Credential $Computers\u00a0=\u00a0Get-Content\u00a0-Path\u00a0C:\\servers.txt<\/code><\/pre>\n<p>  <b>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0430\u043f\u0442\u0430\u0439\u043c \u0434\u0430\u0442\u0443 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u0432 \u0432 AD:<\/b><\/p>\n<pre><code class=\"powershell\"> $ADComputers = (Get-ADComputer -filter *).DNSHostName  foreach ($i in $ADComputers) {       Invoke-Command $i {         Get-CimInstance Win32_operatingsystem |         Select-Object LastBootUpTime,         @{Name=\"Uptime\";Expression = {(Get-Date) - $_.LastBootUptime}}      }    } <\/code><\/pre>\n<p>  <b>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u0441\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0430 \u0432\u0441\u0435\u0445 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430\u0445 AD:<\/b><\/p>\n<pre><code class=\"powershell\">$ADComputers\u00a0=\u00a0(Get-ADComputer\u00a0-filter\u00a0*).DNSHostName foreach\u00a0($i\u00a0in\u00a0$ADComputers)\u00a0{ \u00a0 \u00a0\u00a0\u00a0\u00a0Invoke-Command\u00a0-computername\u00a0$i\u00a0{ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0gcim\u00a0win32_product\u00a0-computername\u00a0$env:computername\u00a0|\u00a0Sort-Object\u00a0-property\u00a0Vendor,Name\u00a0|\u00a0Select-Object\u00a0-property\u00a0Vendor,Name,\u00a0Caption\u00a0 \u00a0\u00a0\u00a0\u00a0}\u00a0 \u00a0 }<\/code><\/pre>\n<p>  \u0422\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438 \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432, \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0432 \u0432 Invoke-Command:<\/p>\n<pre><code class=\"powershell\">Get-WindowsFeature\u00a0|\u00a0Where-Object\u00a0-Property\u00a0\"Installed\"\u00a0-EQ\u00a0\"Installed\"<\/code><\/pre>\n<p>  <b>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u044b, \u0433\u0434\u0435 \u0437\u0430\u043f\u0443\u0449\u0435\u043d \u043d\u0443\u0436\u043d\u044b\u0439 \u043d\u0430\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441:<\/b><\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u0431\u044b\u043b\u0438 \u043d\u0430 \u043a\u0430\u043a\u043e\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u0430 \u0442\u0430 \u0438\u043b\u0438 \u0438\u043d\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0435\u0451 \u0442\u0430\u043a\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430:<\/p>\n<pre><code class=\"powershell\">$ADComputers\u00a0=\u00a0(Get-ADComputer\u00a0-filter\u00a0*).DNSHostName foreach\u00a0($i\u00a0in\u00a0$ADComputers)\u00a0{ \u00a0 \u00a0\u00a0\u00a0\u00a0Invoke-Command\u00a0-computername\u00a0$i\u00a0{ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Get-Process\u00a0-Name\u00a0\"Chrome\" \u00a0-ErrorAction\u00a0SilentlyContinue \u00a0\u00a0\u00a0\u00a0}\u00a0 \u00a0 }<\/code><\/pre>\n<p>  \u0423\u0431\u0438\u0442\u044c \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a \u0436\u0435 \u043b\u0435\u0433\u043a\u043e, \u043a\u0430\u043a \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441:<\/p>\n<pre><code class=\"powershell\">$ADComputers\u00a0=\u00a0(Get-ADComputer\u00a0-filter\u00a0*).DNSHostName foreach\u00a0($i\u00a0in\u00a0$ADComputers)\u00a0{ \u00a0 \u00a0\u00a0\u00a0\u00a0Invoke-Command\u00a0-computername\u00a0$i\u00a0{ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Get-Process\u00a0-Name\u00a0\"Chrome\" |\u00a0Stop-Process\u00a0-ErrorAction\u00a0SilentlyContinue \u00a0\u00a0\u00a0\u00a0}\u00a0 \u00a0 }<\/code><\/pre>\n<p>  <b>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u044b, \u0433\u0434\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430:<\/b><\/p>\n<p>  \u041a\u043e\u043a\u0440\u0435\u0442\u043d\u043e \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 Java. \u041f\u043e\u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438\u043c\u0435\u043d\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u0432 \u0433\u0434\u0435 \u043e\u043d\u0430 \u0431\u044b\u043b\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430.<\/p>\n<pre><code class=\"powershell\">$ADComputers\u00a0=\u00a0(Get-ADComputer\u00a0-filter\u00a0*).DNSHostName foreach\u00a0($i\u00a0in\u00a0$ADComputers)\u00a0{ \u00a0 \u00a0\u00a0\u00a0\u00a0Invoke-Command\u00a0-computername\u00a0$i\u00a0{ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0gcim\u00a0win32_product\u00a0-computername\u00a0$env:computername\u00a0|\u00a0Select-String\u00a0-Pattern\u00a0\"Java\"\u00a0-AllMatches\u00a0|\u00a0Sort-Object\u00a0-property\u00a0Vendor,Name\u00a0|\u00a0Format-Table -ErrorAction\u00a0SilentlyContinue \u00a0 \u00a0\u00a0\u00a0\u00a0}\u00a0 \u00a0 }<\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0434\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u0445 \u0432 \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e. \u041d\u0430\u0434\u0435\u0435\u043c\u0441\u044f, \u044d\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0431\u044b\u043b\u0438 \u0434\u043b\u044f \u0432\u0430\u0441 \u043f\u043e\u043b\u0435\u0437\u043d\u044b.<\/p>\n<p>  <a href=\"https:\/\/ultravds.com\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ww\/d4\/ro\/wwd4ro5_5a28hvdxyazf3enjxou.png\"><\/a><\/div>\n<p>               <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d() } } }t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>      <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/ultravds\/blog\/483416\/\"> https:\/\/habr.com\/ru\/company\/ultravds\/blog\/483416\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/ultravds\/blog\/483416\/\"><a href=\"https:\/\/habr.com\/ru\/company\/ultravds\/blog\/483416\/\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/9e6\/17e\/c95\/9e617ec959b5c01c569bd9d6a8b1cf8a.png\" width=\"500\"><\/div>\n<p><\/a><br \/>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u043e\u0447\u0435\u043c\u0443 \u043c\u044b \u0432\u0441\u0435 \u043b\u044e\u0431\u0438\u043c Powershell \u043d\u0430 \u043f\u0430\u0440\u0435 \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432. \u0412\u0441\u0435 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u043f\u0440\u0438 \u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u043f\u043e\u0438\u0441\u043a\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \u0438 \u043f\u0440\u043e\u0447\u0438\u0445 \u0434\u0435\u043b\u0430\u0445. Powershell \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d \u0443\u0434\u043e\u0431\u043d\u044b\u043c\u0438 \u0438 \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u044e\u0449\u0438\u043c\u0438\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442\u0430\u043c\u0438, \u0430\u0432\u0442\u043e\u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0433\u043e \u0438 \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u044b\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0434\u0435\u043b\u0430\u044e\u0442 \u0435\u0433\u043e \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u0441\u0430\u043c\u044b\u043c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0432 \u043e\u0441\u0432\u043e\u0435\u043d\u0438\u0438 \u044f\u0437\u044b\u043a\u043e\u043c.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u0440\u0443\u0442\u044b\u0445 \u043f\u043e \u043c\u043d\u0435\u043d\u0438\u044e \u0430\u0432\u0442\u043e\u0440\u0430 \u043a\u043e\u043c\u0430\u043d\u0434 \u0438 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0435\u043c \u043f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u043a\u0440\u0443\u0442\u043e. \u041d\u0430\u0447\u043d\u0435\u043c \u0441\u043e \u0441\u043d\u0438\u043f\u0435\u0442\u043e\u0432.  <\/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-296967","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/296967","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=296967"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/296967\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=296967"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=296967"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=296967"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}