<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; VBScript: Добавление записи в реестр в зависимости от переменной]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=7593</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=7593&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «VBScript: Добавление записи в реестр в зависимости от переменной».]]></description>
		<lastBuildDate>Thu, 20 Sep 2012 11:17:02 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: VBScript: Добавление записи в реестр в зависимости от переменной]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=64013#p64013</link>
			<description><![CDATA[<p>Правильнее - скрипт запускать от имени админской у/з.<br />Конечно, можно и предварительно с командной строки (запущенной от имени администратора) переписать права на ветку - консольная утилита subinacl.exe (на микрософте).</p>]]></description>
			<author><![CDATA[null@example.com (Rom5)]]></author>
			<pubDate>Thu, 20 Sep 2012 11:17:02 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=64013#p64013</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBScript: Добавление записи в реестр в зависимости от переменной]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=64007#p64007</link>
			<description><![CDATA[<div class="quotebox"><cite>Бродяга пишет:</cite><blockquote><p>В этой ветви реестра &quot;HKEY_LOCAL_MACHINE&quot; нет прав на запись у пользователя.</p></blockquote></div><p>И не должно быть.</p><div class="quotebox"><cite>Бродяга пишет:</cite><blockquote><p>Теперь новый вопрос, как повысить права у скрипта???</p></blockquote></div><p>Это не вопрос повышения прав.</p><p><strong>Бродяга</strong>, в Вашем коде нет 39 строки.</p>]]></description>
			<author><![CDATA[null@example.com (alexii)]]></author>
			<pubDate>Thu, 20 Sep 2012 05:50:28 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=64007#p64007</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBScript: Добавление записи в реестр в зависимости от переменной]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=64006#p64006</link>
			<description><![CDATA[<p>---------------------------<br />Windows Script Host<br />---------------------------<br />Сценарий:	R:\Проекты\VPN\v 1.0\77.vbs<br />Строка:	39<br />Символ:	4<br />Ошибка:	Неверная ссылка на корень в разделе реестра &quot;HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PolicyAgent\AssumeUDPEncapsulationContextOnSendRule&quot;.<br />Код:	80070005<br />Источник: 	WshShell.RegWrite</p><p>---------------------------<br />ОК&nbsp; &nbsp;<br />---------------------------</p>]]></description>
			<author><![CDATA[null@example.com (Бродяга)]]></author>
			<pubDate>Thu, 20 Sep 2012 05:37:52 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=64006#p64006</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBScript: Добавление записи в реестр в зависимости от переменной]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=64005#p64005</link>
			<description><![CDATA[<p>Разобрался наконец!<br />В этой ветви реестра &quot;HKEY_LOCAL_MACHINE&quot; нет прав на запись у пользователя.</p><p>Теперь новый вопрос, как повысить права у скрипта???</p>]]></description>
			<author><![CDATA[null@example.com (Бродяга)]]></author>
			<pubDate>Thu, 20 Sep 2012 05:29:24 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=64005#p64005</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBScript: Добавление записи в реестр в зависимости от переменной]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=64004#p64004</link>
			<description><![CDATA[<p><span style="color: Green">Код на форуме оформляется <a href="http://forum.script-coding.com/help.php#bbcode">тэгом «code»</a>. Я поправил Ваш пост.</span></p><div class="quotebox"><cite>Бродяга пишет:</cite><blockquote><p>Говорит что неправильная ветка, хотя ветка 100% правильна</p></blockquote></div><p>Приведите точное сообщение об ошибке (нажмите Ctrl-C в окне сообщения об ошибке).</p>]]></description>
			<author><![CDATA[null@example.com (alexii)]]></author>
			<pubDate>Thu, 20 Sep 2012 05:20:34 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=64004#p64004</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBScript: Добавление записи в реестр в зависимости от переменной]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=64002#p64002</link>
			<description><![CDATA[<div class="codebox"><pre><code>Set Sh = CreateObject(&quot;WScript.Shell&quot;)
key =  &quot;HKEY_LOCAL_MACHINE\&quot;
Sh.RegWrite key &amp; &quot;SYSTEM\CurrentControlSet\Services\PolicyAgent\&quot;, &quot;AssumeUDPEncapsulationContextOnSendRule&quot;
Sh.RegWrite key &amp; &quot;SYSTEM\CurrentControlSet\Services\PolicyAgent\AssumeUDPEncapsulationContextOnSendRule&quot;, 00000002, &quot;REG_DWORD&quot;
WScript.Echo Sh.RegRead(key &amp; &quot;SYSTEM\CurrentControlSet\Services\PolicyAgent\&quot;)
WScript.Echo Sh.RegRead(key &amp; &quot;SYSTEM\CurrentControlSet\Services\PolicyAgent\AssumeUDPEncapsulationContextOnSendRule&quot;)
Sh.RegDelete key &amp; &quot;SYSTEM\CurrentControlSet\Services\PolicyAgent\&quot;</code></pre></div><p>Говорит что неправильная ветка, хотя ветка 100% правильна</p>]]></description>
			<author><![CDATA[null@example.com (Бродяга)]]></author>
			<pubDate>Thu, 20 Sep 2012 04:48:50 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=64002#p64002</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBScript: Добавление записи в реестр в зависимости от переменной]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=63997#p63997</link>
			<description><![CDATA[<p>Рассказывайте, как пробуете, приводите Ваш код. Пишите, что не выходит, какие ошибки появляются. И т.п.</p>]]></description>
			<author><![CDATA[null@example.com (alexii)]]></author>
			<pubDate>Wed, 19 Sep 2012 15:41:35 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=63997#p63997</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBScript: Добавление записи в реестр в зависимости от переменной]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=63992#p63992</link>
			<description><![CDATA[<p>Пробую уже второй день! Нечего не выходит!</p>]]></description>
			<author><![CDATA[null@example.com (Бродяга)]]></author>
			<pubDate>Wed, 19 Sep 2012 12:41:05 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=63992#p63992</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBScript: Добавление записи в реестр в зависимости от переменной]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=63991#p63991</link>
			<description><![CDATA[<p>А когда же учиться?</p>]]></description>
			<author><![CDATA[null@example.com (alexii)]]></author>
			<pubDate>Wed, 19 Sep 2012 12:16:00 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=63991#p63991</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBScript: Добавление записи в реестр в зависимости от переменной]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=63989#p63989</link>
			<description><![CDATA[<div class="quotebox"><cite>alexii пишет:</cite><blockquote><div class="quotebox"><cite>Бродяга пишет:</cite><blockquote><p>Мда, помощь!!!!</p></blockquote></div><p>«Халява, сэр!»</p></blockquote></div><p>Ты в прошлый раз помог, не откажи и сейчас!</p>]]></description>
			<author><![CDATA[null@example.com (Бродяга)]]></author>
			<pubDate>Wed, 19 Sep 2012 12:04:55 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=63989#p63989</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBScript: Добавление записи в реестр в зависимости от переменной]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=63988#p63988</link>
			<description><![CDATA[<div class="quotebox"><cite>Бродяга пишет:</cite><blockquote><p>Мда, помощь!!!!</p></blockquote></div><p>«Халява, сэр!»</p>]]></description>
			<author><![CDATA[null@example.com (alexii)]]></author>
			<pubDate>Wed, 19 Sep 2012 12:01:18 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=63988#p63988</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBScript: Добавление записи в реестр в зависимости от переменной]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=63985#p63985</link>
			<description><![CDATA[<p>Мда, помощь!!!!</p>]]></description>
			<author><![CDATA[null@example.com (Бродяга)]]></author>
			<pubDate>Wed, 19 Sep 2012 11:24:45 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=63985#p63985</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBScript: Добавление записи в реестр в зависимости от переменной]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=63983#p63983</link>
			<description><![CDATA[<div class="quotebox"><cite>Бродяга пишет:</cite><blockquote><p>Запись в реестр <br />...</p></blockquote></div><p>Берете со статьи <a href="http://www.script-coding.com/WMI_StdRegProv.html">Рецепты WMI: работа с реестром Windows</a> примеры, тестите отдельно, а потом вставляйте в свои конструкции &quot;case ....&quot;.</p>]]></description>
			<author><![CDATA[null@example.com (Rom5)]]></author>
			<pubDate>Wed, 19 Sep 2012 09:51:30 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=63983#p63983</guid>
		</item>
		<item>
			<title><![CDATA[VBScript: Добавление записи в реестр в зависимости от переменной]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=63981#p63981</link>
			<description><![CDATA[<p>Дробрый день.<br />Есть такая проблема, есть скрипт VBS который в зависимости от типа ОС запускает установку определённого файла.<br />Надо в этот скрипт вставить функцию записи в реестр в зависимости от типа ОС.</p><p>Сам скрипт:<br /></p><div class="codebox"><pre><code>Option Explicit

Dim strShare
Dim strComputer
Dim objFSO

Dim objSWbemLocator
Dim objSWbemServicesEx
Dim collSWbemObjectSet
Dim objSWbemObjectEx
Set objFSO = WScript.CreateObject(&quot;Scripting.FileSystemObject&quot;)

Dim strCommandLine
Dim lngProcessID

strComputer = &quot;.&quot;
strShare   = objFSO.GetParentFolderName(WScript.ScriptFullName)

Set objSWbemLocator    = WScript.CreateObject(&quot;WbemScripting.SWbemLocator&quot;)
Set objSWbemServicesEx = objSWbemLocator.ConnectServer(strComputer, &quot;root\cimv2&quot;)
Set collSWbemObjectSet = objSWbemServicesEx.InstancesOf(&quot;Win32_OperatingSystem&quot;)

For Each objSWbemObjectEx In collSWbemObjectSet
    With objSWbemObjectEx
        Select Case .Version
            Case &quot;5.1.2600&quot;             &#039; Windows XP X86
                strCommandLine = strShare &amp; &quot;\vpn\77\Win_XP\x86\VPN_77.exe&quot;
            Case &quot;5.2.3790&quot;             &#039; Windows XP X64 (&amp; Windows Server 2003)
                strCommandLine = strShare &amp; &quot;\vpn\77\Win_XP\x86\VPN_77.exe&quot;
            Case &quot;6.1.7600&quot;, &quot;6.1.7601&quot; &#039; Windows 7 (&amp; Windows Server 2008 R2)
                Select Case .OSArchitecture
                    Case &quot;32-bit&quot;       &#039; X86
                    strCommandLine = strShare &amp; &quot;\vpn\77\Win_XP\x86\VPN_77.exe&quot;
                    Case &quot;64-bit&quot;       &#039; X64
                    strCommandLine = strShare &amp; &quot;\vpn\77\Win_XP\x86\VPN_77.exe&quot;
                End Select
            Case Else
                &#039; Nothing to do
        End Select
    End With
Next


If Not IsEmpty(strCommandLine) Then
    If objSWbemServicesEx.Get(&quot;Win32_Process&quot;).Create(&quot;&quot;&quot;&quot; &amp; strCommandLine &amp; &quot;&quot;&quot;&quot;, Empty, Nothing, lngProcessID) = 0 Then
    Else
    End If
End If

Set collSWbemObjectSet = Nothing
Set objSWbemServicesEx = Nothing
Set objSWbemLocator    = Nothing

WScript.Quit 0</code></pre></div><p>Запись в реестр для XP<br /></p><div class="codebox"><pre><code>REGEDIT4
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\IPSec]
&quot;AssumeUDPEncapsulationContextOnSendRule&quot;=dword:00000002</code></pre></div><p>Запись в реестр для 7<br /></p><div class="codebox"><pre><code>REGEDIT4
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PolicyAgent]
&quot;AssumeUDPEncapsulationContextOnSendRule&quot;=dword:00000002</code></pre></div><p>Зарание огромное спасибо, т.к. спасли от рутинной работы.</p>]]></description>
			<author><![CDATA[null@example.com (Бродяга)]]></author>
			<pubDate>Wed, 19 Sep 2012 07:17:11 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=63981#p63981</guid>
		</item>
	</channel>
</rss>
