{"id":255450,"date":"2015-04-17T15:15:02","date_gmt":"2015-04-17T11:15:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=255450"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2015-04-17T11:15:02","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=255450","title":{"rendered":"PowerShell: \u0437\u0430 \u0433\u0440\u0430\u043d\u044c\u044e. \u0427\u0430\u0441\u0442\u044c \u0448\u0435\u0441\u0442\u0430\u044f"},"content":{"rendered":"<p>     \t\u041f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0435 \u0432\u0435\u0449\u0438 \u043e\u0442\u043d\u044e\u0434\u044c \u043d\u0435 \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u044b \u043a\u0430\u043a \u043e \u043d\u0438\u0445 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043e \u0434\u0443\u043c\u0430\u0442\u044c, \u0438 \u0435\u0441\u043b\u0438 \u043d\u0430 \u043d\u0438\u0445 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u043e\u0434 \u0438\u043d\u044b\u043c \u0443\u0433\u043b\u043e\u043c, \u043f\u0440\u0438\u0447\u0435\u043c \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0441 \u0432\u044b\u0441\u043e\u043a\u0438\u043c \u0433\u0440\u0430\u0434\u0443\u0441\u043e\u043c \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u043c \u043f\u043e\u0445\u043c\u0435\u043b\u044c\u0435, \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u043d\u0435\u0447\u0442\u043e \u043d\u043e\u0432\u043e\u0435, \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0435 \u0432\u043e \u043c\u043d\u043e\u0433\u043e\u043c \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438, \u043f\u0440\u043e\u0444\u0438\u043b\u0438 PowerShell \u2014 \u0442\u0435 \u0436\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u043e\u0432 *nix, \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438. \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0434\u043d\u043e \u043e \u043f\u0440\u043e\u0444\u0438\u043b\u044f\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432\u043e \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435:<\/p>\n<pre><code class=\"perl\">PS C:\\&gt; man about_Profiles <\/code><\/pre>\n<p>  \u0421\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043f\u0438\u0445\u0430\u0442\u044c \u0432 \u043f\u0440\u043e\u0444\u0438\u043b\u044c \u0432\u0441\u0435 \u0447\u0442\u043e \u043d\u0438 \u043f\u043e\u043f\u043e\u0434\u044f \u043d\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u2014 \u0447\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0435\u0441 \u0444\u0430\u0439\u043b\u0430, \u0442\u0435\u043c \u043c\u0435\u043d\u0435\u0435 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0445\u043e\u0441\u0442\u0430, \u0435\u0441\u043b\u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043d\u0435 \u0431\u044b\u043b \u0443\u043a\u0430\u0437\u0430\u043d \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \/noprofile \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e. \u041e\u0431\u044b\u0447\u043d\u043e \u043f\u0440\u043e\u0444\u0438\u043b\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u043d\u0435\u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e\u0441\u0442\u0435\u0439 (\u043e \u043d\u0438\u0445 \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435), \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u044f\u0441\u043d\u0438\u0442\u044c \u044d\u0442\u043e \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435.<\/p>\n<pre><code class=\"perl\">PS C:\\&gt; ni -Type File -Path $Profile -Force PS C:\\&gt; vim $Profile #vim - \u0441\u0443\u0433\u0443\u0431\u043e \u043b\u0438\u0447\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0435\u043d\u0438\u0435 <\/code><\/pre>\n<p>  \u0411\u044b\u043b\u043e \u0431\u044b \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u0438\u043c\u0435\u0442\u044c \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u0435\u043b\u044f\u043c \u0442\u0438\u043f\u043e\u0432.<\/p>\n<pre><code class=\"perl\">if (($ta = [PSObject].Assembly.GetType(   'System.Management.Automation.TypeAccelerators' ))::Get.Keys -notcontains 'accelerators') {   $ta::Add('accelerators', $ta) } <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u0441\u0442\u0443\u043f\u0438\u043b\u0438 \u0432 \u0441\u0438\u043b\u0443, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0445\u043e\u0441\u0442.<\/p>\n<pre><code class=\"perl\">PS C:\\&gt; ii (ls $env:allusersprofile -r -ea 0).Where({$_.Name -match 'shell.lnk'}).FullName;kill $pid ... PS C:\\&gt; [accelerators]::Get  Key                    Value ---                    ----- Alias                  System.Management.Automation.AliasAttribute AllowEmptyCollection   System.Management.Automation.AllowEmptyCollectionAttribute AllowEmptyString       System.Management.Automation.AllowEmptyStringAttribute AllowNull              System.Management.Automation.AllowNullAttribute array                  System.Array bool                   System.Boolean byte                   System.Byte char                   System.Char CmdletBinding          System.Management.Automation.CmdletBindingAttribute datetime               System.DateTime ... <\/code><\/pre>\n<p>  \u0420\u0430\u043d\u0435\u0435 \u0443\u043f\u043e\u043c\u044f\u043d\u0430\u043b\u043e\u0441\u044c \u043e \u043d\u0435\u043a\u0438\u0445 \u043d\u0435\u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e\u0441\u0442\u044f\u0445, \u0441\u0430\u043c\u0430\u044f \u043f\u043e\u0440\u0430 \u043a \u043d\u0438\u043c \u0432\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 <i>env:<\/i> \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"perl\">PS C:\\&gt; gc env:allusersprofile C:\\ProgramData PS C:\\&gt; $old = gc env:allusersprofile PS C:\\&gt; sc env:allusersprofile C:\\ PS C:\\&gt; gc env:allusersprofile C:\\ PS C:\\&gt; sc env:allusersprofile $old PS C:\\&gt; gc env:allusersprofile C:\\ProgramData <\/code><\/pre>\n<p>  \u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a \u0445\u043e\u0441\u0442\u0430 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u0432\u044b\u0448\u0435 \u0431\u0435\u0437 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <i>allusersprofile<\/i> \u2014 \u043d\u0435 \u0441\u0430\u043c\u0430\u044f \u043b\u0443\u0447\u0448\u0430\u044f \u0438\u0434\u0435\u044f, \u0438, \u0435\u0441\u043b\u0438 \u0432 \u0442\u043e\u043c \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c, \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 <i>Environment+SpecialFolder<\/i> \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0435\u0434\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 <i>env:<\/i> \u0432 \u0432\u0438\u0434\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442.<\/p>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a \u041a\u043e\u0440\u0437\u0438\u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043a\u0430\u043a \u043f\u0443\u043d\u043a\u0442 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432, \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043d\u0435 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0441\u0435\u0431\u0435 \u0437\u0430\u0434\u0430\u0447\u0443 \u0438 \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435?!<\/p>\n<pre><code class=\"perl\">Set-Content function:trash {   param(     [Parameter(Mandatory=$true)]     [ValidateScript({Test-Path $_})]     [String]$Path   )    (New-Object -ComObject Shell.Application).NameSpace(0xA).MoveHere(     (Convert-Path $Path)   ) } <\/code><\/pre>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043c\u0435\u0449\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0432 \u041a\u043e\u0440\u0437\u0438\u043d\u0443 \u0441\u0442\u0430\u043d\u0435\u0442 \u043f\u0440\u043e\u0449\u0435:<\/p>\n<pre><code class=\"perl\">PS C:\\&gt; trash E:\\doc\\foo <\/code><\/pre>\n<p>  \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u043d\u0435\u0437\u043d\u0430\u043a\u043e\u043c\u044b\u0445 \u0441\u043b\u043e\u0432? \u0414\u0435\u043d\u0435\u0433 \u043d\u0430 \u043f\u043e\u043a\u0443\u043f\u043a\u0443 \u0434\u043e\u0440\u043e\u0433\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0443 \u043d\u0430\u0441 \u043d\u0435\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u043d\u043b\u0430\u0439\u043d-\u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0447\u0438\u043a, \u0430 \u0442\u043e\u0447\u043d\u0435\u0435 \u2014 \u042f\u043d\u0434\u0435\u043a\u0441.\u041f\u0435\u0440\u0435\u0432\u043e\u0434, \u0431\u043b\u0430\u0433\u043e \u0443 \u0442\u043e\u0433\u043e \u0432\u043c\u0435\u043d\u044f\u0435\u043c\u043e\u0435 API, \u0434\u0430 \u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u0432 \u043d\u0435\u043f\u043b\u043e\u0445\u043e\u0435. \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c API-\u043a\u043b\u044e\u0447.<\/p>\n<pre><code class=\"perl\">PS C:\\&gt; $key = '...' #API-\u043a\u043b\u044e\u0447 PS C:\\&gt; $bin = &quot;$([Environment]::GetFolderPath('UserProfile'))\\yatrans.bin&quot; PS C:\\&gt; Add-Type -AssemblyName System.Security PS C:\\&gt; [IO.File]::WriteAllBytes( &gt;&gt; $bin, &gt;&gt; [Security.Cryptography.ProtectedData]::Protect( &gt;&gt; [Text.Encoding]::Unicode.GetBytes($key), &gt;&gt; $null, &gt;&gt; [Security.Cryptography.DataProtectionScope]::CurrentUser &gt;&gt; )) &gt;&gt; PS C:\\&gt; attrib +h $bin <\/code><\/pre>\n<p>  \u041a\u043b\u044e\u0447 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438, \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043a \u0447\u0442\u0435\u043d\u0438\u044e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 API. \u0415\u0441\u043b\u0438 \u0436\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u0432\u0442\u0435\u0440\u043f\u0435\u0436, \u0442\u043e \u0432 \u0441\u0430\u043c\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435, \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a.<\/p>\n<pre><code class=\"perl\">function Get-Translation {   param(     [Parameter(Mandatory=$true)]     [ValidateNotNullOrEmpty()]     [String]$Data   )      begin {     Add-Type -AssemblyName System.Security     # \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0430     if (Test-Path ($key = &quot;$([Environment]::GetFolderPath('UserProfile'))\\yatrans.bin&quot;)) {       $key = [Text.Encoding]::Unicode.GetString(         [Security.Cryptography.ProtectedData]::Unprotect(           [IO.File]::ReadAllBytes($key),           $null,           [Security.Cryptography.DataProtectionScope]::CurrentUser         )       )     }     else {       throw 'API-\u043a\u043b\u044e\u0447 \u042f\u043d\u0434\u0435\u043a\u0441.\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d.'     }     # url-root     $url = 'https:\/\/translate.yandex.net\/api\/v1.5\/tr\/'     # \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u044f\u0437\u044b\u043a\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u0430     $detect = &quot;$($url)detect?key=$key&text=&quot;     # \u043f\u0435\u0440\u0435\u0432\u043e\u0434     $transl = &quot;$($url)translate?key=$key&text=%t&lang=%l-ru&format=plain&quot;     # user agent     $usr = 'Mozilla\/5.0 (Windows NT 6.3; rv:37.0.1) Gecko\/20100101 Firefox\/37.0.1'   }   process {     # \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432     $Data = if (Test-Path $Data) { gc $Data } else { $Data }     $res = [xml](wget &quot;$detect$Data&quot; -DisableKeepAlive -UseBasicParsing -UserAgent $usr).Content     if ($res.DetectedLang.code -ne 200) {       throw '\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u044f\u0437\u044b\u043a.'     }          $transl = $transl -replace '%t', $Data     $transl = $transl -replace '%l', $res.DetectedLang.lang     $res = [xml](wget $transl -DisableKeepAlive -UseBasicParsing -UserAgent $usr).Content     if ($res.Translation.code -ne 200) {       throw '\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u0442\u0435\u043a\u0441\u0442.'     }     $res.Translation.text   } } <\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438:<\/p>\n<pre><code class=\"perl\">PS C:\\&gt; Get-Translation 'Die Zeit ist auf!' - \u0412\u0440\u0435\u043c\u044f! PS C:\\&gt; vim foo Hey, teacher! Leave this kids alone! ... PS C:\\&gt; Get-Translation foo \u042d\u0439, \u0443\u0447\u0438\u0442\u0435\u043b\u044c! \u041e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0434\u0435\u0442\u0435\u0439 \u0432 \u043f\u043e\u043a\u043e\u0435! PS C:\\&gt; ri foo PS C:\\&gt; <\/code><\/pre>\n<p>  \u041a \u0441\u043b\u043e\u0432\u0443, \u042f\u043d\u0434\u0435\u043a\u0441 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u0437\u043d\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 IP \u2014 \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u0433\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0445\u043e\u0437\u044f\u0439\u0441\u0442\u0432\u0435:<\/p>\n<pre><code class=\"perl\">$par = @{   Uri = 'http:\/\/ipv4.internet.yandex.ru\/internet\/api\/v0\/ip'   DisableKeepAlive = $true   UseBasicParsing = $true   UserAgent = 'Mozilla\/5.0 (Windows NT 6.3; rv:37.0.1) Gecko\/20100101 Firefox\/37.0.1' }  (wget @par).Content -replace [Char]34, '' <\/code><\/pre>\n<p>  \u0412\u0441\u0435, \u0447\u0442\u043e \u043d\u0435 \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043f\u043e\u0432\u0441\u0435\u0434\u043d\u0435\u0432\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0435, \u043b\u0443\u0447\u0448\u0435 \u0432\u044b\u043d\u043e\u0441\u0438\u0442\u044c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438.     \t<\/p>\n<div class=\"clear\"><\/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\/post\/255973\/\"> http:\/\/habrahabr.ru\/post\/255973\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>     \t\u041f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0435 \u0432\u0435\u0449\u0438 \u043e\u0442\u043d\u044e\u0434\u044c \u043d\u0435 \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u044b \u043a\u0430\u043a \u043e \u043d\u0438\u0445 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043e \u0434\u0443\u043c\u0430\u0442\u044c, \u0438 \u0435\u0441\u043b\u0438 \u043d\u0430 \u043d\u0438\u0445 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u043e\u0434 \u0438\u043d\u044b\u043c \u0443\u0433\u043b\u043e\u043c, \u043f\u0440\u0438\u0447\u0435\u043c \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0441 \u0432\u044b\u0441\u043e\u043a\u0438\u043c \u0433\u0440\u0430\u0434\u0443\u0441\u043e\u043c \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u043c \u043f\u043e\u0445\u043c\u0435\u043b\u044c\u0435, \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u043d\u0435\u0447\u0442\u043e \u043d\u043e\u0432\u043e\u0435, \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0435 \u0432\u043e \u043c\u043d\u043e\u0433\u043e\u043c \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b.  <\/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-255450","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/255450","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=255450"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/255450\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=255450"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=255450"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=255450"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}