{"id":255043,"date":"2015-04-12T22:08:02","date_gmt":"2015-04-12T18:08:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=255043"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=255043","title":{"rendered":"PowerShell: \u0437\u0430 \u0433\u0440\u0430\u043d\u044c\u044e. \u0427\u0430\u0441\u0442\u044c \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u0430\u044f"},"content":{"rendered":"<br \/>\n<blockquote><p><i>\u0420\u0435\u0439\u0442\u0438\u043d\u0433\u0438 \u2014 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043f\u0440\u0438\u0441\u0442\u0440\u0430\u0441\u0442\u0438\u0439, \u0430 \u043d\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438<br \/>  \u0438\u043b\u0438 \u043f\u0440\u043e\u043d\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0443\u043c\u0430 \u0433\u043e\u043b\u043e\u0441\u0443\u044e\u0449\u0435\u0433\u043e.<\/i><br \/>  \u0413.\u0413\u0430\u0440\u0435\u0442\u0442<\/p><\/blockquote>\n<p>  \u041d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0441\u0440\u0435\u0434\u0438 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u043e\u0432 Windows \u043d\u0430\u0439\u0434\u0443\u0442\u0441\u044f \u0442\u0435, \u043a\u043e\u0433\u043e \u043e\u0437\u0430\u0434\u0430\u0447\u0438\u0432\u0430\u043b\u0438 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0438, \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 PowerShell \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u043a\u0430\u043a\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442\u044b \u043d\u0435\u043f\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0443, \u0430 \u043a\u0430\u043a\u0438\u0435 \u2014 \u043d\u0435\u0442. \u0418 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0431\u0435\u0437 \u0431\u0443\u0442\u044b\u043b\u043a\u0438, \u0430 \u0442\u043e \u0438 \u0434\u0432\u0443\u0445, \u0437\u0434\u0435\u0441\u044c \u044f\u0432\u043d\u043e \u043d\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f. \u0414\u0435\u043b\u043e, \u043f\u0440\u0430\u0432\u0434\u0430, \u043d\u0435 \u0432 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u043f\u0438\u0440\u0442\u043d\u043e\u0433\u043e, \u043f\u0440\u044f\u043c\u043e \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044e \u0442\u0440\u0435\u0437\u0432\u043e\u0441\u0442\u0438 \u0443\u043c\u0430, \u0433\u043b\u0430\u0432\u043d\u0443\u044e \u0440\u043e\u043b\u044c \u0437\u0434\u0435\u0441\u044c \u0441\u043a\u043e\u0440\u0435\u0435 \u0438\u0433\u0440\u0430\u0435\u0442 \u0432\u0441\u0435 \u0436\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043c\u044b\u0441\u043b\u0438\u0442\u044c \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f\u043c\u0438. \u041e\u0434\u043d\u0438 \u0433\u043e\u0432\u043e\u0440\u044f\u0442, \u0434\u0435\u0441\u043a\u0430\u0442\u044c, \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u044d\u0442\u0430 \u043e\u0431\u0440\u0435\u0447\u0435\u043d\u0430 \u0432 \u0441\u0430\u043c\u043e\u043c \u0437\u0430\u0440\u043e\u0434\u044b\u0448\u0435, \u0434\u0440\u0443\u0433\u0438\u0435 \u0432\u0438\u0434\u044f\u0442 \u0432\u043e \u0432\u0441\u0435\u043c \u044d\u0442\u043e\u043c \u043d\u0435\u043a\u0438\u0435 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u044b, \u0442\u0440\u0435\u0442\u044c\u0438, \u0431\u0443\u0434\u0443\u0447\u0438 \u043f\u0440\u0438\u0432\u0435\u0440\u0436\u0435\u043d\u0446\u0430\u043c\u0438 \u0438\u0434\u0435\u0438 \u00ab\u0431\u0435\u0437 \u0440\u0430\u0437\u043d\u0438\u0446\u044b \u043a\u0430\u043a\u0430\u044f \u041e\u0421\u044c, \u043b\u0438\u0448\u044c \u0431\u044b \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u00bb, \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0442\u0435\u0448\u0430\u0441\u044c \u043f\u0435\u0440\u0435\u043f\u0430\u043b\u043a\u0430\u043c\u0438 \u043f\u0435\u0440\u0432\u044b\u0445 \u0434\u0432\u0443\u0445.<br \/>  <a name=\"habracut\"><\/a><br \/>  <b>One vision, one purpose!<\/b><br \/>  \u0414\u043b\u044f \u0447\u0435\u0433\u043e \u0431\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d PowerShell \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u043e, \u0435\u0441\u043b\u0438 \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u043e\u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e \u0441 \u043d\u0438\u043c \u0438 \u0433\u043e\u043b\u043e\u0439 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u044e \u044d\u0442\u0430\u043a \u043c\u0438\u043d\u0443\u0442 \u0434\u0435\u0441\u044f\u0442\u044c. \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430, \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438 \u0434\u0430\u043b\u0435\u043a\u043e \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043d\u0430\u0441\u0443\u0449\u043d\u044b\u0445, \u0441\u0440\u0435\u0434\u0438 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u0441\u0435\u0442\u0435\u0439 Windows \u0437\u0440\u0435\u043b\u0430 \u0434\u0430\u0432\u043d\u043e, \u0430 \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u0438 \u0435\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438, \u043a\u0430\u043a-\u0442\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u043e \u0441\u0442\u0430\u043b\u0438 \u0435\u044e \u0440\u0430\u0441\u043f\u043e\u0440\u044f\u0436\u0430\u0442\u044c\u0441\u044f: \u043a\u0442\u043e-\u0442\u043e \u0441\u0442\u0430\u043b \u0440\u0430\u0437\u043c\u0435\u043d\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0431\u043b\u043e\u0433\u043e\u0432, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0433\u043b\u0430\u0432\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0431\u044b\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0435 \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044f \u043e \u043d\u044e\u0430\u043d\u0441\u0430\u0445, \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0449\u0438\u0435\u0441\u044f \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u043c\u0438 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435; \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u0438\u043c\u0447\u0438\u0432\u044b\u0435 \u0441\u0442\u0440\u043e\u0447\u0430\u0442 \u043a\u043d\u0438\u0433\u0438, \u044f\u0432\u043b\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u0432 \u043f\u043e\u0434\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0432\u043e\u043b\u044c\u043d\u044b\u043c \u043f\u0435\u0440\u0435\u0441\u043a\u0430\u0437\u043e\u043c \u0441\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u043e\u0433\u043e \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430 \u0438 \u043b\u0438\u0448\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u0438\u0435 \u0443\u0432\u0438\u0434\u0435\u043b\u0438 \u0432 PowerShell \u043d\u0430\u0440\u044f\u0434\u0443 \u0441\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u044f\u0437\u044b\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0412 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0432\u044b\u0431\u043e\u0440 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0432 \u043f\u043e\u043b\u044c\u0437\u0443 PowerShell, \u0440\u043e\u0432\u043d\u043e \u043a\u0430\u043a \u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442, \u043e\u0441\u043e\u0431\u043e\u0439 \u043f\u043e\u0433\u043e\u0434\u044b \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0443 \u0431\u0435\u0437 \u0440\u0430\u0437\u043d\u0438\u0446\u044b \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043e\u043d\u0440\u043e\u043b\u044c\u043d\u0443\u044e \u0442\u043e\u0447\u043a\u0443 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"bash\">wmic \/namespace:\\\\root\\default path SystemRestore call CreateRestorePoint &quot;\u0421\u0438\u0441\u0442\u0435\u043c\u043d\u0430\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430&quot;, 100, 7 <\/code><\/pre>\n<p>  \u0418\u043b\u0438 \u0442\u043e \u0436\u0435, \u043d\u043e \u0432 PowerShell:<\/p>\n<pre><code class=\"perl\">[void]([wmiclass]'\\\\.\\root\\default:SystemRestore').CreateRestorePoint('\u0421\u0438\u0441\u0442\u0435\u043c\u043d\u0430\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430', 7, 100) <\/code><\/pre>\n<p>  \u0412 \u0442\u043e\u043c \u0436\u0435 PowerShell&#8217;\u0435:<\/p>\n<pre><code class=\"perl\">man Checkpoint-Computer <\/code><\/pre>\n<p>  \u0418 \u0432\u0441\u0435 \u0436\u0435 \u0442\u043e, \u0447\u0442\u043e \u0432 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0441\u043b\u0443\u0436\u0438\u0442 \u043e\u0434\u043d\u043e\u0439 \u0446\u0435\u043b\u0438, \u0440\u0430\u0441\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u043e \u043c\u043d\u043e\u0433\u043e\u043c \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c.<\/p>\n<p>  <b>Shell\u2026 PowerShell!<\/b><br \/>  \u0421 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0433\u043e\u043b\u0443\u0431\u043e\u0433\u043e \u0445\u043e\u0441\u0442\u0430 \u043d\u0430 \u0441\u0432\u0435\u0442 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043d\u0435\u043c\u0430\u043b\u043e. \u0413\u043b\u0430\u0432\u043d\u044b\u043c \u043a\u043e\u0437\u044b\u0440\u0435\u043c PowerShell, \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u0441\u0442\u0430\u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u0438, \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0432\u0448\u0438\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0434\u043e \u043f\u0440\u0435\u0434\u0435\u043b\u043e\u0432, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u0445 \u0440\u0430\u0437\u0432\u0435 \u0447\u0442\u043e \u0444\u0430\u043d\u0442\u0430\u0437\u0438\u0435\u0439 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043f\u0438\u0441\u0430\u0442\u0435\u043b\u044f. \u041d\u0430\u0440\u044f\u0434\u0443 \u0441\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f\u043c\u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c\u0438 \u0435\u0441\u0442\u044c \u0432\u0435\u0449\u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u043d\u0430\u0447\u0435 \u043a\u0430\u043a \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0435\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 PowerShell \u0438 \u043d\u0435 \u043d\u0430\u0437\u043e\u0432\u0435\u0448\u044c. \u0415\u0441\u043b\u0438 \u0431\u0440\u0430\u0442\u044c \u043b\u0438\u0447\u043d\u044b\u0439 \u043e\u043f\u044b\u0442, \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0442\u0430\u043a\u0438\u0445 \u0431\u0435\u0441\u0442\u043e\u043b\u043a\u043e\u0432\u044b\u0445 \u0432\u0435\u0449\u0435\u0439 \u0431\u044b\u043b\u0438 \u0430\u043d\u0430\u043b\u043e\u0433\u043e\u0432\u044b\u0435 \u0447\u0430\u0441\u044b.<\/p>\n<pre><code class=\"perl\">function Show-AnalogClock {   Add-Type -AssemblyName System.Windows.Forms      function private:radpnt([Int32]$radius, [Int32]$seconds) {     $c = New-Object Drawing.Point(($this.ClientRectangle.Width \/ 2), ($this.ClientRectangle.Height \/ 2))     [Double]$angle =- (($seconds - 15) % 60) * [Math]::PI \/ 30     New-Object Drawing.Point(       ($c.X + [Int32]($radius * [Math]::Cos($angle))),       ($c.Y - [Int32]($radius * [Math]::Sin($angle)))     )   }      $frmMain = New-Object Windows.Forms.Form   $tmrTick = New-Object Windows.Forms.Timer   #   #tmrTick   #   $tmrTick.Enabled = $true   $tmrTick.Interval = 1000   $tmrTick.Add_Tick({$frmMain.Invalidate()})   #   #frmMain   #   $frmMain.ClientSize = New-Object Drawing.Size(150, 150)   $frmMain.FormBorderStyle = [Windows.Forms.FormBorderStyle]::FixedSingle   $frmMain.Icon = [Drawing.Icon]::ExtractAssociatedIcon(&quot;$PSHome\\powershell.exe&quot;)   'MaximizeBox', 'MinimizeBox' | % {$frmMain.$_ = $false}   $frmMain.StartPosition = [Windows.Forms.FormStartPosition]::CenterScreen   $frmMain.Text = 'Analog Clock'   $frmMain.Add_Paint({     $now = [DateTime]::Now          $g = $this.CreateGraphics()     $c = New-Object Drawing.Point(($this.ClientRectangle.Width \/ 2), ($this.ClientRectangle.Height \/ 2))     $r = [Math]::Min($this.ClientRectangle.Width, $this.ClientRectangle.Height) \/ 2     #\u0444\u043e\u043d \u0446\u0438\u0444\u0435\u0440\u0431\u043b\u0430\u0442\u0430     $b = New-Object Drawing.Drawing2D.LinearGradientBrush(       $this.ClientRectangle, [Drawing.Color]::Linen, [Drawing.Color]::DarkGreen,       [Drawing.Drawing2D.LinearGradientMode]::BackwardDiagonal     )          $g.FillEllipse($b, $c.X - $r, $c.Y - $r, $r * 2, $r * 2)     #\u043c\u0438\u043d\u0443\u0442\u043d\u044b\u0435 \u0437\u0430\u0441\u0435\u0447\u043a\u0438     for ($min = 0; $min -lt 60; $min++) {       [Drawing.Point]$pnt = radpnt ($r - 10) $min       $sb = New-Object Drawing.SolidBrush([Drawing.Color]::Black)              if (($min % 5) -eq 0) {         $g.FillRectangle($sb, $pnt.X - 3, $pnt.Y - 3, 6, 6)       }       else {         $g.FillRectangle($sb, $pnt.X - 1, $pnt.Y - 1, 2, 2)       }     }     #\u0441\u0442\u0440\u0435\u043b\u043a\u0438     $hp = New-Object Drawing.Pen([Drawing.Color]::Black, 8)     $mp = New-Object Drawing.Pen([Drawing.Color]::Black, 6)     $sp = New-Object Drawing.Pen([Drawing.Color]::Red, 1)     #\u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0430 \u0441\u0442\u0440\u0435\u043b\u043e\u043a     $hp, $mp | % {       $_.StartCap = [Drawing.Drawing2D.LineCap]::Round       $_.EndCap = [Drawing.Drawing2D.LineCap]::Round     }     $sp.CustomEndCap = New-Object Drawing.Drawing2D.AdjustableArrowCap(2, 3, $true)     $pin = New-Object Drawing.SolidBrush([Drawing.Color]::Red)     $g.DrawLine(       $hp,       (radpnt 15 (30 + $now.Hour * 5 + $now.Minute \/ 12)),       (radpnt ([Int32]($r * 0.55)) ($now.Hour * 5 + $now.Minute \/ 12))     )     $g.DrawLine($mp, (radpnt 15 (30 + $now.Minute)), (radpnt ([Int32]($r * 0.8)) $now.Minute))     $g.DrawLine($sp, (radpnt 20 ($now.Second + 30)), (radpnt ($r - 2) $now.Second))     $g.FillEllipse($pin, $c.X - 5, $c.Y - 5, 10, 10)   })      [void]$frmMain.ShowDialog() } <\/code><\/pre>\n<p>  \u0415\u0441\u0442\u044c \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430\u043f\u0438\u043b\u044c\u043d\u0438\u043a\u043e\u043c, \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0432\u0435\u0441\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043e \u0443\u043c\u0430. \u041d\u043e \u044d\u0442\u043e \u0432\u0441\u0435, \u043a\u0430\u043a \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u0440\u0430\u043d\u0435\u0435, \u0438\u0437 \u0440\u0430\u0437\u0440\u044f\u0434\u0430 \u0431\u0430\u043b\u043e\u0432\u0441\u0442\u0432\u0430. \u041b\u0443\u0447\u0448\u0435 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0431\u0440\u0430\u0442\u0438\u043c\u0441\u044f \u043a \u0437\u0430\u0434\u0430\u0447\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043f\u043e\u043b\u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0432 \u043f\u043e\u0432\u0441\u0435\u0434\u043d\u0435\u0432\u043d\u043e\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u0430\u043a \u0434\u0430\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0443 \u043f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u044e? \u041c\u043e\u0436\u043d\u043e \u043d\u0430\u043a\u043e\u043b\u0431\u0430\u0441\u0438\u0442\u044c \u043a\u043e\u0434 \u043d\u0430 C# \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Add-Type, \u043d\u043e \u0435\u0441\u043b\u0438 \u043f\u043e\u043a\u043e\u0432\u044b\u0440\u044f\u0442\u044c\u0441\u044f ILDASM&#8217;\u043e\u043c \u0432 \u043d\u0435\u0434\u0440\u0430\u0445 \u0441\u0431\u043e\u0440\u043e\u043a .NET Framework, \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0444\u043b\u0435\u043a\u0441\u0438\u044e.<\/p>\n<pre><code class=\"perl\">function Set-Privilege {   param(     [Parameter(Mandatory=$true, Position=0)]     [ValidateSet(       'SeAssignPrimaryTokenPrivilege', 'SeAuditPrivilege', 'SeBackupPrivilege', 'SeChangeNotifyPrivilege',       'SeCreateGlobalPrivilege', 'SeCreatePagefilePrivilege', 'SeCreatePermanentPrivilege',       'SeCreateSymbolicLinkPrivilege', 'SeCreateTokenPrivilege', 'SeDebugPrivilege', 'SeEnableDelegationPrivilege',       'SeImpersonatePrivilege', 'SeIncreaseBasePriorityPrivilege', 'SeIncreaseQuotaPrivilege',       'SeIncreaseWorkingSetPrivilege', 'SeLoadDriverPrivilege', 'SeLockMemoryPrivilege', 'SeMachineAccountPrivilege',       'SeManageVolumePrivilege', 'SeProfileSingleProcessPrivilege', 'SeRelabelPrivilege', 'SeRemoteShutdownPrivilege',       'SeRestorePrivilege', 'SeSecurityPrivilege', 'SeShutdownPrivilege', 'SeSyncAgentPrivilege',       'SeSystemEnvironmentPrivilege', 'SeSystemProfilePrivilege', 'SeSystemtimePrivilege', 'SeTakeOwnershipPrivilege',       'SeTcbPrivilege', 'SeTimeZonePrivilege', 'SeTrustedCredManAccessPrivilege', 'SeUndockPrivilege',       'SeUnsolicitedInputPrivilege'     )]     [String]$Privilege,          [Parameter(Position=1)]     [Switch]$Disable,          [Parameter(Position=2)]     [Diagnostics.Process]$Process = (Get-Process -Id $PID)   )      begin {     #SE_PRIVILEGE_[DIS|EN]ABLED     ($Win32Native = ($mscorlib = [Object].Assembly).GetType(       'Microsoft.Win32.Win32Native'     )).GetFields(($bfs = [Reflection.BindingFlags]40)) | ? {       $_.Name -match '\\Ase_p.*d\\Z'     } | % {       Set-Variable $_.Name ([UInt32]$_.GetValue($null))     }     #AdjustTokenPrivileges, LookupPrivilegeValue \u0438 OpenProcessToken     $Win32Native.GetMethods($bfs) | ? {       $_.Name -match '\\A(Adjust|LookupP|OpenP).*\\Z'     } | % {       Set-Variable $_.Name $_     }     #LUID, LUID_AND_ATTRIBUTES \u0438 TOKEN_PRIVILEGES     $Win32Native.GetNestedTypes(($bfi = [Reflection.BindingFlags]36)) | ? {       $_.Name -match '\\A(LUID|TOKEN_P).*\\Z'     } | % {       Set-Variable $_.Name $_     }   }   process {     try {       $SafeTokenHandle = $mscorlib.GetType(         'Microsoft.Win32.SafeHandles.SafeTokenHandle'       ).GetConstructor(         $bfi, $null, [Type[]]@([IntPtr]), $null       ).Invoke([IntPtr]::Zero)              if (!$OpenProcessToken.Invoke($null, (         $sth = [Object[]]@($Process.Handle, [Security.Principal.TokenAccessLevels]40, $SafeTokenHandle)       ))) {         throw (New-Object Exception('\u041d\u0435 \u043c\u043e\u0433\u0443 \u043d\u0430\u0439\u0442\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441.'))       }              $LUID = [Activator]::CreateInstance($LUID)       $LUID.GetType().GetFields($bfi) | % { $_.SetValue($LUID, [UInt32]0) }              if (!$LookupPrivilegeValue.Invoke($null, (         $LUID = [Object[]]@($null, $Privilege, $LUID)       ))) {         throw (New-Object Exception('\u041d\u0435 \u043c\u043e\u0433\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c LUID.'))       }              $State = switch ($Disable) {         $true  { $SE_PRIVILEGE_DISABLED }         $false { $SE_PRIVILEGE_ENABLED }       }              $LUID_AND_ATTRIBUTES = [Activator]::CreateInstance($LUID_AND_ATTRIBUTES)       $LUID_AND_ATTRIBUTES.GetType().GetField('Luid', $bfi).SetValue($LUID_AND_ATTRIBUTES, $LUID[2])       $LUID_AND_ATTRIBUTES.GetType().GetField('Attributes', $bfi).SetValue($LUID_AND_ATTRIBUTES, $State)              $TOKEN_PRIVILEGE = [Activator]::CreateInstance($TOKEN_PRIVILEGE)       $TOKEN_PRIVILEGE.GetType().GetField('Privilege', $bfi).SetValue($TOKEN_PRIVILEGE, $LUID_AND_ATTRIBUTES)       $TOKEN_PRIVILEGE.GetType().GetField('PrivilegeCount', $bfi).SetValue($TOKEN_PRIVILEGE, [UInt32]1)              [UInt32]$sz = [Runtime.InteropServices.Marshal]::SizeOf($TOKEN_PRIVILEGE)       if (!$AdjustTokenPrivileges.Invoke($null, @(         $sth[2], $false, $TOKEN_PRIVILEGE, $sz, $null, $null       ))) {         throw (New-Object Exception('\u041d\u0435 \u043c\u043e\u0433\u0443 \u0434\u0430\u0442\u044c \u043f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u044e.'))       }     }     catch { $_.Exception }     finally {       if ($sth -is [Array] -and $sth[2] -ne $null) { $sth[2].Close() }       if ($SafeTokenHandle -ne $null) { $SafeTokenHandle.Close() }     }   }   end {} } <\/code><\/pre>\n<p>  \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0434\u0430\u0435\u043c \u043f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u044e:<\/p>\n<pre><code class=\"perl\">PS C:\\&gt; Set-Privilege SeShutdownPrivilege <\/code><\/pre>\n<p>  \u041f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u044e \u0437\u0430\u0431\u0438\u0440\u0430\u0435\u043c:<\/p>\n<pre><code class=\"perl\">PS C:\\&gt; Set-Privilege SeShutdownPrivilege -Disable <\/code><\/pre>\n<p>  <b>Peace through Power!<\/b><br \/>  \u041d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u043e\u0434\u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0430 \u0432 PowerShell \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438. \u041d\u0435 \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0434\u0443\u043c\u044b\u0432\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0441\u0432\u0435\u0440\u044a\u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435, \u0430 \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u0437\u0430\u0435\u0437\u0436\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440: \u0434\u0430\u0442\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0432\u0445\u043e\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443. \u0418\u0442\u0430\u043a, \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043f\u0435\u0440\u0432\u044b\u0439:<\/p>\n<pre><code class=\"perl\">$Marshal = [Runtime.InteropServices.Marshal] $ft = New-Object Runtime.InteropServices.ComTypes.FILETIME  $raw = (gp &quot;HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\$(   [Security.Principal.WindowsIdentity]::GetCurrent().User.Value )&quot;).PSObject.Properties | ? {$_.Name -match 'time'} $ft.dwLowDateTime = $raw[0].Value $ft.dwHighDateTime = $raw[1].Value  try {   $ptr = $Marshal::AllocHGlobal($Marshal::SizeOf($ft))   $Marshal::StructureToPtr($ft, $ptr, $false)   [DateTime]::FromFileTime($Marshal::ReadInt64($ptr)) } catch { $_.Exception } finally {   if ($ptr -ne [IntPtr]::Zero) { $Marshal::FreeHGlobal($ptr) } } <\/code><\/pre>\n<p>  \u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u0432\u0442\u043e\u0440\u043e\u0439:<\/p>\n<pre><code class=\"perl\">(gp ('HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Profilelist\\' + [Security.Principal.WindowsIdentity]::GetCurrent().User.Value) | select @{N='LoggedTime';E={   ([DateTime]'1.1.1601').AddDays(     ($_.ProfileLoadTimeHigh * [Math]::Pow(2, 32) + $_.ProfileLoadTimeLow) \/ (       6 * [Math]::Pow(10, 8)     ) \/ 1440   ).ToLocalTime() }}).LoggedTime <\/code><\/pre>\n<p>  \u0410 \u0435\u0441\u043b\u0438 \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043d\u0430\u0439\u0434\u0435\u0442\u0441\u044f \u0435\u0449\u0435 \u0438 \u0442\u0440\u0435\u0442\u0438\u0439, \u0438 \u043f\u0440\u043e\u0447\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b.     \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\/255563\/\"> http:\/\/habrahabr.ru\/post\/255563\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<br \/>\n<blockquote><p><i>\u0420\u0435\u0439\u0442\u0438\u043d\u0433\u0438 \u2014 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043f\u0440\u0438\u0441\u0442\u0440\u0430\u0441\u0442\u0438\u0439, \u0430 \u043d\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438<br \/>  \u0438\u043b\u0438 \u043f\u0440\u043e\u043d\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0443\u043c\u0430 \u0433\u043e\u043b\u043e\u0441\u0443\u044e\u0449\u0435\u0433\u043e.<\/i><br \/>  \u0413.\u0413\u0430\u0440\u0435\u0442\u0442<\/p><\/blockquote>\n<p>  \u041d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0441\u0440\u0435\u0434\u0438 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u043e\u0432 Windows \u043d\u0430\u0439\u0434\u0443\u0442\u0441\u044f \u0442\u0435, \u043a\u043e\u0433\u043e \u043e\u0437\u0430\u0434\u0430\u0447\u0438\u0432\u0430\u043b\u0438 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0438, \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 PowerShell \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u043a\u0430\u043a\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442\u044b \u043d\u0435\u043f\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0443, \u0430 \u043a\u0430\u043a\u0438\u0435 \u2014 \u043d\u0435\u0442. \u0418 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0431\u0435\u0437 \u0431\u0443\u0442\u044b\u043b\u043a\u0438, \u0430 \u0442\u043e \u0438 \u0434\u0432\u0443\u0445, \u0437\u0434\u0435\u0441\u044c \u044f\u0432\u043d\u043e \u043d\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f. \u0414\u0435\u043b\u043e, \u043f\u0440\u0430\u0432\u0434\u0430, \u043d\u0435 \u0432 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u043f\u0438\u0440\u0442\u043d\u043e\u0433\u043e, \u043f\u0440\u044f\u043c\u043e \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044e \u0442\u0440\u0435\u0437\u0432\u043e\u0441\u0442\u0438 \u0443\u043c\u0430, \u0433\u043b\u0430\u0432\u043d\u0443\u044e \u0440\u043e\u043b\u044c \u0437\u0434\u0435\u0441\u044c \u0441\u043a\u043e\u0440\u0435\u0435 \u0438\u0433\u0440\u0430\u0435\u0442 \u0432\u0441\u0435 \u0436\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043c\u044b\u0441\u043b\u0438\u0442\u044c \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f\u043c\u0438. \u041e\u0434\u043d\u0438 \u0433\u043e\u0432\u043e\u0440\u044f\u0442, \u0434\u0435\u0441\u043a\u0430\u0442\u044c, \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u044d\u0442\u0430 \u043e\u0431\u0440\u0435\u0447\u0435\u043d\u0430 \u0432 \u0441\u0430\u043c\u043e\u043c \u0437\u0430\u0440\u043e\u0434\u044b\u0448\u0435, \u0434\u0440\u0443\u0433\u0438\u0435 \u0432\u0438\u0434\u044f\u0442 \u0432\u043e \u0432\u0441\u0435\u043c \u044d\u0442\u043e\u043c \u043d\u0435\u043a\u0438\u0435 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u044b, \u0442\u0440\u0435\u0442\u044c\u0438, \u0431\u0443\u0434\u0443\u0447\u0438 \u043f\u0440\u0438\u0432\u0435\u0440\u0436\u0435\u043d\u0446\u0430\u043c\u0438 \u0438\u0434\u0435\u0438 \u00ab\u0431\u0435\u0437 \u0440\u0430\u0437\u043d\u0438\u0446\u044b \u043a\u0430\u043a\u0430\u044f \u041e\u0421\u044c, \u043b\u0438\u0448\u044c \u0431\u044b \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u00bb, \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0442\u0435\u0448\u0430\u0441\u044c \u043f\u0435\u0440\u0435\u043f\u0430\u043b\u043a\u0430\u043c\u0438 \u043f\u0435\u0440\u0432\u044b\u0445 \u0434\u0432\u0443\u0445.  <\/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-255043","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/255043","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=255043"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/255043\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=255043"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=255043"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=255043"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}