<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; VBS: перевести bat в vbs-смена сетевых настроек ip, dns]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=11135</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=11135&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «VBS: перевести bat в vbs-смена сетевых настроек ip, dns».]]></description>
		<lastBuildDate>Mon, 21 Dec 2015 11:34:56 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: VBS: перевести bat в vbs-смена сетевых настроек ip, dns]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=99838#p99838</link>
			<description><![CDATA[<p><strong>Flasher</strong><br />Понял. Тему создал.</p>]]></description>
			<author><![CDATA[null@example.com (madjahed)]]></author>
			<pubDate>Mon, 21 Dec 2015 11:34:56 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=99838#p99838</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBS: перевести bat в vbs-смена сетевых настроек ip, dns]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=99834#p99834</link>
			<description><![CDATA[<p><strong>madjahed</strong><br />Тогда создайте отдельную тему для задания 2., ибо объединять разные задачи в одном топике - оффтоп.</p>]]></description>
			<author><![CDATA[null@example.com (Flasher)]]></author>
			<pubDate>Mon, 21 Dec 2015 10:31:34 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=99834#p99834</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBS: перевести bat в vbs-смена сетевых настроек ip, dns]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=99831#p99831</link>
			<description><![CDATA[<p><strong>Flasher</strong><br />Спасибо, но хотелось бы в итоге иметь один файл, а не два. Так что желательней полностью конвертировать.</p>]]></description>
			<author><![CDATA[null@example.com (madjahed)]]></author>
			<pubDate>Mon, 21 Dec 2015 08:17:06 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=99831#p99831</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBS: перевести bat в vbs-смена сетевых настроек ip, dns]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=99828#p99828</link>
			<description><![CDATA[<p><strong>madjahed</strong><br />Конечно, можно полностью конвертировать, но если проблема только в наличии чёрных окон, то проще всего запускать батники из скрипта:<br /></p><div class="codebox"><pre><code>&#039;==================================================
&#039; Скрыть окно программы
&#039; Параметры: &quot;&lt;путь к утилите&gt;&quot; &lt;ключи и параметры&gt;
&#039;==================================================
With WScript.Arguments
  Util = &quot;&quot;&quot;&quot; &amp; .Item(0) &amp; &quot;&quot;&quot;&quot; : C = .Count
  If C &gt; 1 Then
    For i = 1 to C - 1 : S = S &amp; &quot; &quot; &amp; .Item(i) : Next
  End If
End With : CreateObject(&quot;WScript.Shell&quot;).Run Util &amp; S, 0</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Flasher)]]></author>
			<pubDate>Mon, 21 Dec 2015 00:29:20 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=99828#p99828</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBS: перевести bat в vbs-смена сетевых настроек ip, dns]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=99783#p99783</link>
			<description><![CDATA[<p><strong>godvin</strong><br />Спасибо, действительно работает.<br />А кто поможет со вторым батником? Очень уж бесят досовские черные окна</p>]]></description>
			<author><![CDATA[null@example.com (madjahed)]]></author>
			<pubDate>Sat, 19 Dec 2015 14:16:22 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=99783#p99783</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBS: перевести bat в vbs-смена сетевых настроек ip, dns]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=99751#p99751</link>
			<description><![CDATA[<p>Попробовал также следующий вариант: <br /></p><div class="codebox"><pre><code>strComputer = &quot;.&quot;
Set objRegistry = GetObject(&quot;winmgmts:{impersonationLevel=impersonate}!\\&quot; &amp;strComputer &amp; &quot;\root\default:StdRegProv&quot;)
Set WshShell = CreateObject(&quot;WScript.Shell&quot;)
Set objWMIService = GetObject(&quot;winmgmts:\\&quot; &amp; strComputer &amp; &quot;\root\cimv2&quot;)
Set colNetAdapters = objWMIService.ExecQuery (&quot;Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE&quot;)
Dim result
result = MsgBox(&quot;Интернет- Да; Основа- Нет&quot;, vbYesNo _
+ vbQuestion, &quot;Подключение&quot;)
If result = vbYes Then
WshShell.RegWrite &quot;HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable&quot;,&quot;0&quot;,&quot;REG_DWORD&quot;
objRegistry.CreateKey HKEY_CURRENT_USER, &quot;Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections&quot;
objRegistry.SetBinaryValue HKEY_CURRENT_USER,&quot;Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections&quot;,&quot;DefaultConnectionSettings&quot;,array (&amp;H46,&amp;H00,&amp;H00, и т.д.)
strIPAddress = Array(&quot;10.1.1.1&quot;) 
strSubnetMask = Array(&quot;255.255.255.128&quot;) 
strGateway = Array(&quot;10.1.1.2&quot;) 
strGatewayMetric = Array(1)
strDNS = Array(&quot;10.1.1.1&quot;, &quot;10.2.2.2&quot;, &quot;8.8.8.8&quot;) 
For Each objNetAdapter in colNetAdapters
    errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
    errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric)
    errDNS = objNetAdapter.SetDnsServerSearchOrder(strDNS)
    WScript.Echo &quot;Подключено к СЕТЬ1.&quot;
Next
Else
WshShell.RegWrite &quot;HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable&quot;,&quot;1&quot;,&quot;REG_DWORD&quot;
WshShell.RegWrite &quot;HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyOverride&quot;,&quot;west.ua;100.200.400.2;&lt;local&gt;&quot;,&quot;REG_SZ&quot;
WshShell.RegWrite &quot;HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyServer&quot;,&quot;westrr.ua:8080&quot;,&quot;REG_SZ&quot;
objRegistry.SetBinaryValue HKEY_CURRENT_USER,&quot;Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections&quot;,&quot;DefaultConnectionSettings&quot;,array (&amp;H46,&amp;H00, и т.д.)
strIPAddress = Array(&quot;10.1.1.3&quot;) 
strSubnetMask = Array(&quot;255.255.255.128&quot;) 
strGateway = Array(&quot;10.1.1.4&quot;) 
strGatewayMetric = Array(1)
strDNS = Array(&quot;10.1.1.4&quot;, &quot;10.2.2.2&quot;, &quot;8.8.8.8&quot;) 
For Each objNetAdapter in colNetAdapters
    errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
    errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric)
    errDNS = objNetAdapter.SetDnsServerSearchOrder(strDNS)
    WScript.Echo &quot;Подключено к СЕТЬ2.&quot;
Next
End if</code></pre></div><p> Проверил - работает.</p>]]></description>
			<author><![CDATA[null@example.com (godvin)]]></author>
			<pubDate>Fri, 18 Dec 2015 15:22:02 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=99751#p99751</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBS: перевести bat в vbs-смена сетевых настроек ip, dns]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=99714#p99714</link>
			<description><![CDATA[<p><strong>madjahed</strong><br />Насчет первого скрипта, попробуйте поколдовать над этим:</p><div class="codebox"><pre><code>strComputer = &quot;.&quot;
Set WshShell = CreateObject(&quot;WScript.Shell&quot;)
Set objWMIService = GetObject(&quot;winmgmts:\\&quot; &amp; strComputer &amp; &quot;\root\cimv2&quot;)
Set colNetAdapters = objWMIService.ExecQuery (&quot;Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE&quot;)
Dim result
result = MsgBox(&quot;Интернет- Да; Основа- Нет&quot;, vbYesNo _
+ vbQuestion, &quot;Подключение&quot;)
If result = vbYes Then
WshShell.RegWrite &quot;HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable&quot;,&quot;0&quot;,&quot;REG_DWORD&quot;
WshShell.RegWrite &quot;HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections\DefaultConnectionSettings&quot;,&quot;&amp;H46,&amp;H00, и т.д.&quot;,&quot;REG_BINARY&quot;
strIPAddress = Array(&quot;10.1.1.1&quot;) 
strSubnetMask = Array(&quot;255.255.255.128&quot;) 
strGateway = Array(&quot;10.1.1.2&quot;) 
strGatewayMetric = Array(1)
strDNS = Array(&quot;10.1.1.1&quot;, &quot;10.2.2.2&quot;, &quot;8.8.8.8&quot;) 
For Each objNetAdapter in colNetAdapters
    errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
    errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric)
    errDNS = objNetAdapter.SetDnsServerSearchOrder(strDNS)
    WScript.Echo &quot;Подключено к СЕТЬ1.&quot;
Next
Else
WshShell.RegWrite &quot;HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable&quot;,&quot;1&quot;,&quot;REG_DWORD&quot;
WshShell.RegWrite &quot;HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyOverride&quot;,&quot;west.ua;100.200.400.2;&lt;local&gt;&quot;,&quot;REG_SZ&quot;
WshShell.RegWrite &quot;HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyServer&quot;,&quot;westrr.ua:8080&quot;,&quot;REG_SZ&quot;
WshShell.RegWrite &quot;HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections\DefaultConnectionSettings&quot;,&quot;&amp;H46,&amp;H00,&amp;H00, и т.д.&quot;,&quot;REG_BINARY&quot;
strIPAddress = Array(&quot;10.1.1.3&quot;) 
strSubnetMask = Array(&quot;255.255.255.128&quot;) 
strGateway = Array(&quot;10.1.1.4&quot;) 
strGatewayMetric = Array(1)
strDNS = Array(&quot;10.1.1.4&quot;, &quot;10.2.2.2&quot;, &quot;8.8.8.8&quot;) 
For Each objNetAdapter in colNetAdapters
    errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
    errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric)
    errDNS = objNetAdapter.SetDnsServerSearchOrder(strDNS)
    WScript.Echo &quot;Подключено к СЕТЬ2.&quot;
Next
End if</code></pre></div><p>Айпишники подставлять не стал - набил наубом. Буду благодарен если кто то присоединится к обсуждению и исправит ошибки. Ругается на несоответсвие типа в строчках где в реестр вносятся двоичные данные.</p>]]></description>
			<author><![CDATA[null@example.com (godvin)]]></author>
			<pubDate>Thu, 17 Dec 2015 13:43:40 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=99714#p99714</guid>
		</item>
		<item>
			<title><![CDATA[VBS: перевести bat в vbs-смена сетевых настроек ip, dns]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=99600#p99600</link>
			<description><![CDATA[<p>Добрый вечер. Появилась необходимость перевести несколько скриптов из формата bat/cmd в vbs/js :<br />1. Скрипт в зависимости от выбора меняет сетевые настройки - ip, ip шлюза, dns, включает или отключает прокси в IE</p><div class="codebox"><pre><code>@echo off
chcp 1251
cls
set /p mesto=&quot;1 - osnova , 2 - internet&quot;
if %mesto% equ 2 goto inet
:Osnova
set IFACE=&quot;Подключение по локальной сети&quot;
set IP=192.2.7.20
set MASK=255.255.255.0
set GATEWAY=192.2.7.1
set GWMETRIC=1
set DNS1=192.168.1.1
set DNS2=192.168.1.25
set DNS3=8.8.8.8
reg add &quot;HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings&quot; /v ProxyEnable /t REG_DWORD /d 0x00000001 /f
reg add &quot;HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings&quot; /v ProxyOverride /t REG_SZ /d &quot;192.168.1.17;192.2.7.2;&lt;local&gt;&quot; /f
reg add &quot;HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings&quot; /v ProxyServer /t REG_SZ /d proxy.osnova.ua:8080 /f
reg add &quot;HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections&quot; /v DefaultConnectionSettings /t REG_BINARY /d 4600000007000000030 и т.д................ /f 
goto smena

:inet
set IFACE=&quot;Подключение по локальной сети&quot;
set IP=192.2.7.35
set MASK=255.255.255.0
set GATEWAY=192.2.7.100
set GWMETRIC=1
set DNS1=192.168.1.1
set DNS2=192.168.1.25
set DNS3=8.8.8.8
reg add &quot;HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings&quot; /v ProxyEnable /t REG_DWORD /d 0x00000000 /f
reg add &quot;HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections&quot; /v DefaultConnectionSettings /t REG_BINARY /d 460000000e0000000100000000000000 и т.д................ /f 
goto smena

:smena
netsh interface ip set address name=%IFACE% source=static addr=%IP% mask=%MASK% gateway=%GATEWAY% gwmetric=%GWMETRIC%
netsh interface ip set DNS %IFACE% static %DNS1% PRIMARY
netsh interface ip add DNS %IFACE% %DNS2% index=2
netsh interface ip add DNS %IFACE% %DNS3% index=3
exit</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (madjahed)]]></author>
			<pubDate>Wed, 09 Dec 2015 19:31:28 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=99600#p99600</guid>
		</item>
	</channel>
</rss>
