<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; CMD/BAT: Перегрузка роутера]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=10639&amp;type=atom" />
	<updated>2015-05-15T21:22:46Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=10639</id>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Перегрузка роутера]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93987#p93987" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>
Set FirstPing=ya.ru
Set SecondPing=google.com
c:
cd\
cd Checker
ping %FirstPing% | Find /v &quot;Ответ от 192.168.0.200&quot; | Find /c &quot;Ответ&quot;
If %ErrorLevel% == 1 Goto :!SecondPing
Goto :!Exit
:!SecondPing
Echo %Date% %Time% %FirstPing% не доступен.&gt;&gt;%ComputerName%.log
ping %SecondPing% | Find /v &quot;Ответ от 192.168.0.200&quot; | Find /c &quot;Ответ&quot;
If %ErrorLevel% == 1 Goto :!Reboot
Goto :!Exit
:!Reboot
taskkill -f -im kitty.exe
Echo %Date% %Time% %SecondPing% не доступен. Перезагрузка роутера.&gt;&gt;%ComputerName%.log
kitty.exe -telnet 192.168.0.1 -cmd admin\npassword\nshell\nreboot\n
:!Exit
</code></pre></div><p>0.1) У роутера открыт telnet (ssh)<br />0.2) Все ip мои, так что под себя нужно дорабатывать<br />1) kitty - одна из реализаций putty, умеющая передавать данные в telnet<br />2) &quot;Ответ от &quot; нужно писать в кодировке 866, ибо русский и cmd<br />3) Если важно скрыть от пользователя, то можно запускать из vbs<br /></p><div class="codebox"><pre><code>
Set WshShell = CreateObject(&quot;WScript.Shell&quot;)
WshShell.Run &quot;cmd /c &quot; &amp; ПутьК.cmd, 0, False
</code></pre></div><p>В общем, направление задано. Скрипт работает на реальных объектах.</p>]]></content>
			<author>
				<name><![CDATA[MikeSh]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24507</uri>
			</author>
			<updated>2015-05-15T21:22:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93987#p93987</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[CMD/BAT: Перегрузка роутера]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93904#p93904" />
			<content type="html"><![CDATA[<p>Всем привет,помогите решить проблему,нужен батник который делал ping DNS,если ошибка запускал перегрузку роутера,желательно чтоб пользователь это не видел.</p>]]></content>
			<author>
				<name><![CDATA[sprintserv]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33045</uri>
			</author>
			<updated>2015-05-11T20:21:26Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93904#p93904</id>
		</entry>
</feed>
