{"id":301129,"date":"2020-04-01T21:00:49","date_gmt":"2020-04-01T21:00:49","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=301129"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=301129","title":{"rendered":"\u0418\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 Minecraft"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/495192\/\"><a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/495192\/\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/p4\/ej\/aj\/p4ejajdnio8gldb2bw8zo6v3uxe.jpeg\"><\/div>\n<p><\/a><\/p>\n<p>  \u0410\u0432\u0442\u043e\u0440 \u043e\u0447\u0435\u043d\u044c \u043b\u044e\u0431\u0438\u0442 \u0438\u0433\u0440\u0443, \u0438 \u0441\u0430\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u043e\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u00ab\u0447\u0438\u0441\u0442\u043e \u0434\u043b\u044f \u0434\u0440\u0443\u0437\u0435\u0439\u00bb. \u041a\u0430\u043a \u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u0440\u0435\u0434\u0438 \u043b\u044e\u0431\u0438\u0442\u0435\u043b\u0435\u0439, \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0437\u0430\u043c\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u0432\u0441\u0435, \u0430 \u044d\u0442\u043e \u0432\u043b\u0435\u0447\u0451\u0442 \u0437\u0430 \u0441\u043e\u0431\u043e\u0439 \u043d\u0435\u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u0438 \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435 \u043f\u0430\u0434\u0435\u043d\u0438\u044f. \u0422\u0430\u043a \u043a\u0430\u043a Powershell \u0430\u0432\u0442\u043e\u0440 \u0437\u043d\u0430\u0435\u0442 \u043b\u0443\u0447\u0448\u0435, \u0447\u0435\u043c \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u0430\u0433\u0430\u0437\u0438\u043d\u043e\u0432 \u043d\u0430 \u0441\u0432\u043e\u0435\u0439 \u0443\u043b\u0438\u0446\u0435, \u043e\u043d \u043f\u0440\u0438\u043d\u044f\u043b \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u00ab<i>\u041b\u0443\u0447\u0448\u0438\u0439 \u0421\u043a\u0440\u0438\u043f\u0442 \u0414\u043b\u044f \u0417\u0430\u043f\u0443\u0441\u043a\u0430 \u041c\u0430\u0439\u043d\u043a\u0440\u0430\u0444\u0442 2020<\/i>\u00bb. \u042d\u0442\u043e\u0442 \u0436\u0435 \u0441\u043a\u0440\u0438\u043f\u0442 \u043f\u043e\u0441\u043b\u0443\u0436\u0438\u043b \u043e\u0441\u043d\u043e\u0432\u043e\u0439 \u0434\u043b\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0432 <a href=\"https:\/\/ruvds.com\/ru-rub\/marketplace\">\u043c\u0430\u0440\u043a\u0435\u0442\u043f\u043b\u0435\u0439\u0441\u0435 Ruvds<\/a>. \u041d\u043e \u0432\u0441\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0432 \u0441\u0442\u0430\u0442\u044c\u0435. \u0421\u0435\u0439\u0447\u0430\u0441 \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443, \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u0441\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043b\u043e\u0441\u044c.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2><font color=\"\u201c#3AC1EF\u201d\">\u041d\u0443\u0436\u043d\u044b\u0435 \u043d\u0430\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u044b<\/font><\/h2>\n<p>  <\/p>\n<h3><font color=\"\u201c#3AC1EF\u201d\">\u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0435 \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/font><\/h3>\n<p>  \u041e\u0434\u043d\u0430\u0436\u0434\u044b \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0432 \u0435\u0449\u0435 \u043f\u0430\u0440\u0443 \u043c\u043e\u0434\u043e\u0432 \u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b, \u0447\u0442\u043e \u0441\u0435\u0440\u0432\u0435\u0440, \u0441\u0443\u0434\u044f \u043f\u043e \u0432\u0441\u0435\u043c\u0443, \u043f\u0430\u0434\u0430\u0435\u0442 \u0431\u0435\u0437 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u043e\u0439\u043d\u044b. \u0421\u0435\u0440\u0432\u0435\u0440 \u043d\u0435 \u043f\u0438\u0441\u0430\u043b \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 latest.log \u0438\u043b\u0438 \u0432 debug, \u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e \u0438\u0434\u0435\u0435 \u044d\u0442\u0443 \u043e\u0448\u0438\u0431\u043a\u0443 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u043b\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f, \u0431\u044b\u043b\u0430 \u0437\u0430\u043a\u0440\u044b\u0442\u0430.<\/p>\n<p>  \u041d\u0435 \u0445\u043e\u0447\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u2013 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e. \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c Powershell \u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442\u043e\u043c <b>Tee-Object<\/b>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0435\u0440\u0451\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0435\u0433\u043e \u0432 \u0444\u0430\u0439\u043b \u0438 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e.<\/p>\n<pre><code class=\"powershell\">.\\handler.ps1 | Tee-Object .\\StandardOutput.txt -Append<\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, Powershell \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0431\u0438\u0440\u0430\u0442\u044c StandardOutput \u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u0444\u0430\u0439\u043b. \u041d\u0435 \u043f\u044b\u0442\u0430\u0439\u0442\u0435\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <b>Start-Process<\/b>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d \u0432\u0435\u0440\u043d\u0435\u0442 System.ComponentModel.Component, \u0430 \u043d\u0435 StandardOutput, \u0430 -RedirectStandardOutput \u0441\u0434\u0435\u043b\u0430\u0435\u0442 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c \u0432\u0432\u043e\u0434 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c, \u0447\u0435\u0433\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c.<\/p>\n<h3><font color=\"\u201c#3AC1EF\u201d\">\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430<\/font><\/h3>\n<p>  \u041f\u043e\u0441\u0442\u0430\u0432\u0438\u0432 \u0442\u0443 \u0441\u0430\u043c\u0443\u044e \u043f\u0430\u0440\u0443 \u043c\u043e\u0434\u043e\u0432, \u0430\u0432\u0442\u043e\u0440 \u0437\u0430\u043c\u0435\u0442\u0438\u043b, \u0447\u0442\u043e \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u043a \u0442\u043e\u043c\u0443 \u0436\u0435 \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438. \u0410 \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043c\u0435\u043d\u044f\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430. \u0412\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e\u00a0\u0447\u0442\u043e\u0431\u044b\u00a0\u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043c\u0435\u043d\u044f\u0442\u044c \u0438\u0445 \u0432 start.bat, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0441\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u00a0\u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u044d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442.<\/p>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a Tee-Object \u0447\u0438\u0442\u0430\u0435\u0442 StandardOutput,\u00a0\u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u0444\u0430\u0439\u043b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u00ab\u041f\u0440\u044f\u043c\u043e \u0442\u0430\u043a\u00bb, \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u0441\u043a\u0440\u0438\u043f\u0442. \u042d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0441\u0430\u043c \u043c\u0430\u0439\u043d\u043a\u0440\u0430\u0444\u0442. \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0432\u00a0\u0431\u0443\u0434\u0443\u0449\u0435\u043c \u043f\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0443\u043b\u044c\u0442\u0438\u043c\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043b\u0435\u043d\u0438, \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043d\u0430 \u043b\u0435\u0442\u0443. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0447\u043d\u0435\u043c \u0441 \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 <b>forge<\/b>.<\/p>\n<pre><code class=\"powershell\">$forge = ((Get-ChildItem | Where-Object Name -Like &quot;forge*&quot;).Name | Sort-Object -Descending) | Select-Object -last 1<\/code><\/pre>\n<p>  \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e sort-object \u043c\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u043c \u0431\u0440\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0441 \u0441\u0430\u043c\u043e\u0439 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0446\u0438\u0444\u0435\u0440\u043a\u043e\u0439, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u044b \u0432\u044b \u0442\u0443\u0434\u0430 \u0438\u0445 \u043d\u0435 \u043f\u043e\u043b\u043e\u0436\u0438\u043b\u0438. \u0423\u043b\u044c\u0442\u0438\u043c\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u043b\u0435\u043d\u044c.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u043f\u0430\u043c\u044f\u0442\u044c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u0435\u0440\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0435\u0433\u043e \u0441\u0443\u043c\u043c\u0443 \u0432 string.<\/p>\n<pre><code class=\"powershell\">$ram = ((Get-CimInstance Win32_PhysicalMemory | Measure-Object -Property capacity -Sum).sum \/1gb) $xmx = &quot;-Xms&quot; + $ram + &quot;G&quot;<\/code><\/pre>\n<p>  <\/p>\n<h3><font color=\"\u201c#3AC1EF\u201d\">\u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a<\/font><\/h3>\n<p>  \u0410\u0432\u0442\u043e\u0440 \u0432\u0438\u0434\u0435\u043b .bat \u0444\u0430\u0439\u043b\u044b \u043e\u0442 \u0434\u0440\u0443\u0433\u0438\u0445 \u043b\u044e\u0434\u0435\u0439, \u043d\u043e \u043e\u043d\u0438 \u043d\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u043b\u0438 \u043f\u0440\u0438\u0447\u0438\u043d\u0443, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0431\u044b\u043b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d. \u042d\u0442\u043e \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0444\u0430\u0439\u043b \u043c\u043e\u0434\u0430 \u0438\u043b\u0438 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0447\u0442\u043e-\u0442\u043e?<br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a. \u0410\u0432\u0442\u043e\u0440 \u0440\u0430\u043d\u0435\u0435 \u043d\u0430\u0442\u044b\u043a\u0430\u043b\u0441\u044f \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0438 \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0435 \u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u043f\u043e\u0447\u0435\u043c\u0443 \u0441\u0435\u0440\u0432\u0435\u0440 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b \u0440\u0430\u0431\u043e\u0442\u0443. \u041c\u044b \u0436\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c exitcode. Java \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 0 \u043a\u0430\u043a \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435, \u043e\u0442\u0441\u044e\u0434\u0430 \u0438 \u0431\u0443\u0434\u0435\u043c \u043f\u043b\u044f\u0441\u0430\u0442\u044c. <\/p>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0433\u043e \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u043e\u0433\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<pre><code class=\"powershell\">function Get-MinecraftExitCode {         do {                  if ($global:Process.ExitCode -ne 0) {             Write-Log             Restart-Minecraft         }         else {             Write-Log         }       } until ($global:Process.ExitCode -eq 0)      } <\/code><\/pre>\n<p>  \u0421\u043a\u0440\u0438\u043f\u0442 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u0432 \u0446\u0438\u043a\u043b\u0435 \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0438\u0437 \u0441\u0432\u043e\u0435\u0439 \u0436\u0435 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043d\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0448\u0442\u0430\u0442\u043d\u043e, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b \/stop.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u043c\u044b \u0432\u0441\u0435 \u0440\u0435\u0448\u0438\u043b\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0442\u043e \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u0431\u044b \u0438 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0434\u0430\u0442\u0443 \u0437\u0430\u043f\u0443\u0441\u043a\u0430, \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435, \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 Start-Process \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e. \u0412 \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"powershell\">$global:Process = Start-Process -FilePath  &quot;C:\\Program Files (x86)\\common files\\Oracle\\Java\\javapath_target_*\\java.exe&quot; -ArgumentList &quot;$xmx -server -jar $forge nogui&quot; -Wait -NoNewWindow -PassThru<\/code><\/pre>\n<p>  \u0410 \u0434\u0430\u043b\u044c\u0448\u0435 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432 \u0444\u0430\u0439\u043b. \u0412\u043e\u0442 \u0447\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u043c \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e:<\/p>\n<pre><code class=\"powershell\">$global:Process.StartTime $global:Process.ExitCode\t $global:Process.ExitTime<\/code><\/pre>\n<p>  \u0412\u0441\u0435 \u044d\u0442\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Add-Content \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0444\u0430\u0439\u043b. \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u0447\u0435\u0441\u0430\u0432, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0430\u043a\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442, \u0430 \u043d\u0430 \u0437\u043e\u0432\u0435\u043c \u0435\u0433\u043e handler.ps1.<\/p>\n<pre><code class=\"powershell\">Add-Content -Value &quot;Start time:&quot; -Path $Logfile  $global:Process.StartTime   Add-Content -Value &quot;Exit code:&quot; -Path $Logfile  $global:Process.ExitCode | Add-Content $Logfile      Add-Content -Value &quot;Exit time:&quot; -Path $Logfile  $global:Process.ExitTime | Add-Content $Logfile <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0444\u043e\u0440\u043c\u0438\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u0441 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c handler\u2019a. <\/p>\n<h3><font color=\"\u201c#3AC1EF\u201d\">\u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f \u0430\u0432\u0442\u043e\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430<\/font><\/h3>\n<p>  \u0410\u0432\u0442\u043e\u0440 \u0445\u043e\u0447\u0435\u0442 \u043e\u0434\u043d\u0438\u043c \u043c\u043e\u0434\u0443\u043b\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043c\u0430\u0439\u043d\u043a\u0440\u0430\u0444\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 \u0438\u0437 \u043b\u044e\u0431\u044b\u0445 \u043f\u0443\u0442\u0435\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u043b\u043e\u0433\u0438 \u0432 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443.<\/p>\n<p>  \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u0441\u0442\u043e\u043b \u0438\u043b\u0438 WinRm. \u0415\u0441\u043b\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440 \u043e\u0442 \u0438\u043c\u0435\u043d\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430, \u043d\u043e \u043d\u0435 \u0432\u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u0442\u043e Server.jar \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442 \u0434\u0430\u0436\u0435 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c eula.txt \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c\u0441\u044f.<\/p>\n<p>  \u0412\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0430\u0432\u0442\u043e\u0432\u0445\u043e\u0434 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0440\u0435\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u0440\u0435\u0435\u0441\u0442\u0440.<\/p>\n<pre><code class=\"powershell\">New-ItemProperty -Path &quot;HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon&quot; -Name DefaultUserName -Value $Username -ErrorAction SilentlyContinue New-ItemProperty -Path &quot;HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon&quot; -Name DefaultPassword -Value $Password  -ErrorAction SilentlyContinue New-ItemProperty -Path &quot;HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon&quot; -Name AutoAdminLogon -Value 1 -ErrorAction SilentlyContinue<\/code><\/pre>\n<p>  \u042d\u0442\u043e \u043d\u0435\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e. \u041b\u043e\u0433\u0438\u043d \u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0442\u0443\u0442 \u043f\u043b\u0435\u0439\u043d\u0442\u0435\u043a\u0441\u0442\u043e\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0434 \u0437\u0430\u043f\u0443\u0441\u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0432\u043e\u0434\u0438\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043c\u0435\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0438\u043b\u0438 \u0432 \u0435\u0449\u0435 \u0431\u043e\u043b\u0435\u0435 \u0443\u0437\u043a\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f.<\/p>\n<p>  \u0421 \u0430\u0432\u0442\u043e\u0432\u0445\u043e\u0434\u043e\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0442\u0430\u0441\u043a\u0443 \u043f\u043e\u0434 \u0441\u0435\u0440\u0432\u0435\u0440. \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0438\u0437 Powershell, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"powershell\">$Trigger = New-ScheduledTaskTrigger -AtLogOn $User = &quot;ServerAdmin&quot; $PS = New-ScheduledTaskAction -Execute 'PowerShell.exe&quot; -Argument &quot;Start-Minecraft -Type Forge -LogFile &quot;C:\\minecraft\\stdout.txt&quot; -MinecraftPath &quot;C:\\minecraft\\&quot;' Register-ScheduledTask -TaskName &quot;StartSSMS&quot; -Trigger $Trigger -User $User -Action $PS -RunLevel Highest<\/code><\/pre>\n<p>  <\/p>\n<h2><font color=\"\u201c#3AC1EF\u201d\">\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c<\/font><\/h2>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0444\u043e\u0440\u043c\u0438\u043c \u0432\u0441\u0435 \u0432 \u043c\u043e\u0434\u0443\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0442\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c. \u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0442\u0443\u0442, \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u0438 \u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435\u0441\u044c.<\/p>\n<p>  \u0412\u0441\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u0432\u044b\u0448\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0445\u043e\u0442\u0438\u0442\u0435 \u0437\u0430\u043c\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0441 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438.<\/p>\n<h3><font color=\"\u201c#3AC1EF\u201d\">Start-Minecraft<\/font><\/h3>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u0438 \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c, \u0447\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0443\u0448\u0430\u0442\u044c \u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c standardoutput. <\/p>\n<p>  \u0412 \u0431\u043b\u043e\u043a\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043e\u043d \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0438\u0437 \u043a\u0430\u043a\u043e\u0439 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043c\u0430\u0439\u043d\u043a\u0440\u0430\u0444\u0442 \u0438 \u043a\u0443\u0434\u0430 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u043b\u043e\u0433.<\/p>\n<pre><code class=\"powershell\">Set-Location (Split-Path $MyInvocation.MyCommand.Path) function Start-Minecraft {     [CmdletBinding()]     param (         [Parameter()]         [ValidateNotNullOrEmpty()]         [string]         $LogFile,           [Parameter(Mandatory)]           [ValidateSet('Vanilla', 'Forge')]         [ValidateNotNullOrEmpty()]         [string]         $Type,           [Parameter(Mandatory)]         [ValidateNotNullOrEmpty()]         [string[]]         $MinecraftPath       )     powershell.exe -file .\\handler.ps1 -type $type -MinecraftPath $MinecraftPath | Tee-Object $LogFile -Append } Export-ModuleMember -Function Start-Minecraft<\/code><\/pre>\n<p>  \u0410 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043c\u0430\u0439\u043d\u043a\u0440\u0430\u0444\u0442 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"powershell\">Start-Minecraft -Type Forge -LogFile &quot;C:\\minecraft\\stdout.txt&quot; -MinecraftPath &quot;C:\\minecraft\\&quot;<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0433\u043e\u0442\u043e\u0432\u043e\u043c\u0443 \u043a \u0443\u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u044e Handler.ps1<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0448 \u0441\u043a\u0440\u0438\u043f\u0442 \u043c\u043e\u0433 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435, \u0442\u0430\u043a\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0431\u043b\u043e\u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u043e\u043d \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 Oracle Java, \u0435\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0434\u0440\u0443\u0433\u043e\u0439 \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432, \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0443\u0442\u044c \u0434\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430.<\/p>\n<pre><code class=\"powershell\">param (     [Parameter()]     [ValidateNotNullOrEmpty()]     [string]$type,       [Parameter()]     [ValidateNotNullOrEmpty()]     [string]$MinecraftPath,       [Parameter()]     [ValidateNotNullOrEmpty()]     [string]$StandardOutput )   Set-Location $MinecraftPath   function Restart-Minecraft {       Write-host &quot;=============== Starting godlike game server ============&quot;       $forge = ((Get-ChildItem | Where-Object Name -Like &quot;forge*&quot;).Name | Sort-Object -Descending) | Select-Object -first 1       $ram = ((Get-CimInstance Win32_PhysicalMemory | Measure-Object -Property capacity -Sum).sum \/1gb)     $xmx = &quot;-Xms&quot; + $ram + &quot;G&quot;     $global:Process = Start-Process -FilePath  &quot;C:\\Program Files (x86)\\common files\\Oracle\\Java\\javapath_target_*\\java.exe&quot; -ArgumentList &quot;$xmx -server -jar $forge nogui&quot; -Wait -NoNewWindow -PassThru      }   function Write-Log {     Write-host &quot;Start time:&quot; $global:Process.StartTime       Write-host &quot;Exit code:&quot; $global:Process.ExitCode          Write-host &quot;Exit time:&quot; $global:Process.ExitTime       Write-host &quot;=============== Stopped godlike game server =============&quot; }   function Get-MinecraftExitCode {         do {                  if ($global:Process.ExitCode -ne 0) {             Restart-Minecraft             Write-Log         }         else {             Write-Log         }       } until ($global:Process.ExitCode -eq 0)      }   Get-MinecraftExitCode <\/code><\/pre>\n<p>  <\/p>\n<h3><font color=\"\u201c#3AC1EF\u201d\">Register-Minecraft<\/font><\/h3>\n<p>  \u0421\u043a\u0440\u0438\u043f\u0442, \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442 Start-Minecraft, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u043d\u043e\u0432\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443. \u041f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0442\u0435 \u0436\u0435 \u0441\u0430\u043c\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b. \u0418\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0431\u044b\u043b\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043e, \u0431\u0435\u0440\u0435\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e.<\/p>\n<pre><code class=\"powershell\">function Register-Minecraft {     [CmdletBinding()]     param (         [Parameter()]         [ValidateNotNullOrEmpty()]         [string]         $LogFile,           [Parameter(Mandatory)]           [ValidateSet('Vanilla', 'Forge')]         [ValidateNotNullOrEmpty()]         [string]$Type,           [Parameter(Mandatory)]         [ValidateNotNullOrEmpty()]         [string]$MinecraftPath,           [Parameter(Mandatory)]         [ValidateNotNullOrEmpty()]         [string]$User,           [Parameter(Mandatory)]         [string]$TaskName = $env:USERNAME     )       $Trigger = New-ScheduledTaskTrigger -AtLogOn     $arguments = &quot;Start-Minecraft -Type $Type -LogFile $LogFile -MinecraftPath $MinecraftPath&quot;     $PS = New-ScheduledTaskAction -Execute &quot;PowerShell&quot; -Argument &quot;-noexit -command $arguments&quot;     Register-ScheduledTask -TaskName $TaskName -Trigger $Trigger -User $User -Action $PS -RunLevel Highest      }   Export-ModuleMember -Function Register-Minecraft<\/code><\/pre>\n<p>  <\/p>\n<h3><font color=\"\u201c#3AC1EF\u201d\">Register-Autologon<\/font><\/h3>\n<p>  \u0412 \u0431\u043b\u043e\u043a\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0441\u043a\u0440\u0438\u043f\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 Username \u0438 Password. \u0415\u0441\u043b\u0438 Username \u043d\u0435 \u0431\u044b\u043b \u0443\u043a\u0430\u0437\u0430\u043d, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0438\u043c\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<pre><code class=\"powershell\">function Set-Autologon {       param (         [Parameter(         HelpMessage=&quot;Username for autologon&quot;)]         $Username = $env:USERNAME,           [Parameter(Mandatory=$true,         HelpMessage=&quot;User password&quot;)]         [ValidateNotNullOrEmpty()]         $Password     )       $i = Get-ItemProperty -Path &quot;HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon&quot;       if ($null -eq $i) {         New-ItemProperty -Path &quot;HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon&quot; -Name DefaultUserName -Value $Username         New-ItemProperty -Path &quot;HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon&quot; -Name DefaultPassword -Value $Password          New-ItemProperty -Path &quot;HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon&quot; -Name AutoAdminLogon -Value 1         Write-Verbose &quot;Set-Autologon will enable user auto logon.&quot;       }     else {         Set-ItemProperty -Path &quot;HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon&quot; -Name DefaultUserName -Value $Username         Set-ItemProperty -Path &quot;HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon&quot; -Name DefaultPassword -Value $Password         Set-ItemProperty -Path &quot;HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon&quot; -Name AutoAdminLogon -Value 1     }            Write-Verbose &quot;Autologon was set successfully.&quot;   } <\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a \u044d\u0442\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"powershell\">Set-Autologon -Password &quot;PlaintextPassword&quot;<\/code><\/pre>\n<p>  <\/p>\n<h3><font color=\"\u201c#3AC1EF\u201d\">\u041a\u0430\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f<\/font><\/h3>\n<p>  \u0421\u0435\u0439\u0447\u0430\u0441 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u043e, \u043a\u0430\u043a \u0441\u0430\u043c \u0430\u0432\u0442\u043e\u0440 \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u043c \u044d\u0442\u0438\u043c. \u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 Minecraft \u043d\u0430 Windows. \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u043d\u0430\u0447\u0430\u043b\u0430.<\/p>\n<p>  <b>1. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/b><\/p>\n<pre><code class=\"powershell\">$pass = Get-Credential New-LocalUser -Name &quot;MinecraftServer&quot; -Password $pass.Password -AccountNeverExpires -PasswordNeverExpires -UserMayNotChangePassword<\/code><\/pre>\n<p>  <b>2. \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u043f\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0443 \u0441\u043a\u0440\u0438\u043f\u0442\u0430<\/b><\/p>\n<p>  \u041c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043e\u0434\u0443\u043b\u044f, \u0442\u0430\u043a:<\/p>\n<pre><code class=\"powershell\">Register-Minecraft -Type Forge -LogFile &quot;C:\\minecraft\\stdout.txt&quot; -MinecraftPath &quot;C:\\minecraft\\&quot; -User &quot;MInecraftServer&quot; -TaskName &quot;MinecraftStarter&quot;<\/code><\/pre>\n<p>  \u0418\u043b\u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438:<\/p>\n<pre><code class=\"powershell\">$Trigger = New-ScheduledTaskTrigger -AtLogOn $User = &quot;ServerAdmin&quot; $PS = New-ScheduledTaskAction -Execute 'PowerShell.exe&quot; -Argument &quot;Start-Minecraft -Type Forge -LogFile &quot;C:\\minecraft\\stdout.txt&quot; -MinecraftPath &quot;C:\\minecraft\\&quot;' Register-ScheduledTask -TaskName &quot;StartSSMS&quot; -Trigger $Trigger -User $User -Action $PS -RunLevel Highest<\/code><\/pre>\n<p>  <b>3. \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0430\u0432\u0442\u043e\u0432\u0445\u043e\u0434 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043c\u0430\u0448\u0438\u043d\u0443<\/b><\/p>\n<pre><code class=\"powershell\">Set-Autologon -Username &quot;MinecraftServer&quot; -Password &quot;Qw3&quot;<\/code><\/pre>\n<p>  <\/p>\n<h3><font color=\"\u201c#3AC1EF\u201d\">\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435<\/font><\/h3>\n<p>  \u0410\u0432\u0442\u043e\u0440 \u0434\u0435\u043b\u0430\u043b \u0441\u043a\u0440\u0438\u043f\u0442, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u0434\u043b\u044f \u0441\u0435\u0431\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443, \u0441 \u0443\u0434\u043e\u0432\u043e\u043b\u044c\u0441\u0442\u0432\u0438\u0435\u043c \u0432\u044b\u0441\u043b\u0443\u0448\u0430\u0435\u0442 \u0432\u0430\u0448\u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044e \u0441\u043a\u0440\u0438\u043f\u0442\u0430. \u0410\u0432\u0442\u043e\u0440 \u043d\u0430\u0434\u0435\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0432\u0435\u0441\u044c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0431\u044b\u043b \u0434\u043b\u044f \u0432\u0430\u0441 \u0445\u043e\u0442\u044f \u0431\u044b \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u0435\u043d, \u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430.<\/p>\n<p>  <a href=\"https:\/\/ruvds.com\/ru-rub\/#order\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/iq\/fi\/b4\/iqfib45pgphfrxv--zfemt0qnmw.jpeg\"><\/a><\/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=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/495192\/\"> https:\/\/habr.com\/ru\/company\/ruvds\/blog\/495192\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/495192\/\"><a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/495192\/\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/p4\/ej\/aj\/p4ejajdnio8gldb2bw8zo6v3uxe.jpeg\"><\/div>\n<p><\/a><\/p>\n<p>  \u0410\u0432\u0442\u043e\u0440 \u043e\u0447\u0435\u043d\u044c \u043b\u044e\u0431\u0438\u0442 \u0438\u0433\u0440\u0443, \u0438 \u0441\u0430\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u043e\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u00ab\u0447\u0438\u0441\u0442\u043e \u0434\u043b\u044f \u0434\u0440\u0443\u0437\u0435\u0439\u00bb. \u041a\u0430\u043a \u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u0440\u0435\u0434\u0438 \u043b\u044e\u0431\u0438\u0442\u0435\u043b\u0435\u0439, \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0437\u0430\u043c\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u0432\u0441\u0435, \u0430 \u044d\u0442\u043e \u0432\u043b\u0435\u0447\u0451\u0442 \u0437\u0430 \u0441\u043e\u0431\u043e\u0439 \u043d\u0435\u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u0438 \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435 \u043f\u0430\u0434\u0435\u043d\u0438\u044f. \u0422\u0430\u043a \u043a\u0430\u043a Powershell \u0430\u0432\u0442\u043e\u0440 \u0437\u043d\u0430\u0435\u0442 \u043b\u0443\u0447\u0448\u0435, \u0447\u0435\u043c \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u0430\u0433\u0430\u0437\u0438\u043d\u043e\u0432 \u043d\u0430 \u0441\u0432\u043e\u0435\u0439 \u0443\u043b\u0438\u0446\u0435, \u043e\u043d \u043f\u0440\u0438\u043d\u044f\u043b \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u00ab<i>\u041b\u0443\u0447\u0448\u0438\u0439 \u0421\u043a\u0440\u0438\u043f\u0442 \u0414\u043b\u044f \u0417\u0430\u043f\u0443\u0441\u043a\u0430 \u041c\u0430\u0439\u043d\u043a\u0440\u0430\u0444\u0442 2020<\/i>\u00bb. \u042d\u0442\u043e\u0442 \u0436\u0435 \u0441\u043a\u0440\u0438\u043f\u0442 \u043f\u043e\u0441\u043b\u0443\u0436\u0438\u043b \u043e\u0441\u043d\u043e\u0432\u043e\u0439 \u0434\u043b\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0432 <a href=\"https:\/\/ruvds.com\/ru-rub\/marketplace\">\u043c\u0430\u0440\u043a\u0435\u0442\u043f\u043b\u0435\u0439\u0441\u0435 Ruvds<\/a>. \u041d\u043e \u0432\u0441\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0432 \u0441\u0442\u0430\u0442\u044c\u0435. \u0421\u0435\u0439\u0447\u0430\u0441 \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443, \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u0441\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043b\u043e\u0441\u044c.  <\/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-301129","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/301129","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=301129"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/301129\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=301129"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=301129"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=301129"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}