<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; VBScript: Добавление записи в реестр в зависимости от переменной]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=7593&amp;type=atom" />
	<updated>2012-09-20T11:17:02Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=7593</id>
		<entry>
			<title type="html"><![CDATA[Re: VBScript: Добавление записи в реестр в зависимости от переменной]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=64013#p64013" />
			<content type="html"><![CDATA[<p>Правильнее - скрипт запускать от имени админской у/з.<br />Конечно, можно и предварительно с командной строки (запущенной от имени администратора) переписать права на ветку - консольная утилита subinacl.exe (на микрософте).</p>]]></content>
			<author>
				<name><![CDATA[Rom5]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5724</uri>
			</author>
			<updated>2012-09-20T11:17:02Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=64013#p64013</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBScript: Добавление записи в реестр в зависимости от переменной]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=64007#p64007" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2012-09-20T05:50:28Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=64007#p64007</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBScript: Добавление записи в реестр в зависимости от переменной]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=64006#p64006" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[Бродяга]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=28174</uri>
			</author>
			<updated>2012-09-20T05:37:52Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=64006#p64006</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBScript: Добавление записи в реестр в зависимости от переменной]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=64005#p64005" />
			<content type="html"><![CDATA[<p>Разобрался наконец!<br />В этой ветви реестра &quot;HKEY_LOCAL_MACHINE&quot; нет прав на запись у пользователя.</p><p>Теперь новый вопрос, как повысить права у скрипта???</p>]]></content>
			<author>
				<name><![CDATA[Бродяга]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=28174</uri>
			</author>
			<updated>2012-09-20T05:29:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=64005#p64005</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBScript: Добавление записи в реестр в зависимости от переменной]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=64004#p64004" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2012-09-20T05:20:34Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=64004#p64004</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBScript: Добавление записи в реестр в зависимости от переменной]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=64002#p64002" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[Бродяга]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=28174</uri>
			</author>
			<updated>2012-09-20T04:48:50Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=64002#p64002</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBScript: Добавление записи в реестр в зависимости от переменной]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=63997#p63997" />
			<content type="html"><![CDATA[<p>Рассказывайте, как пробуете, приводите Ваш код. Пишите, что не выходит, какие ошибки появляются. И т.п.</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2012-09-19T15:41:35Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=63997#p63997</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBScript: Добавление записи в реестр в зависимости от переменной]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=63992#p63992" />
			<content type="html"><![CDATA[<p>Пробую уже второй день! Нечего не выходит!</p>]]></content>
			<author>
				<name><![CDATA[Бродяга]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=28174</uri>
			</author>
			<updated>2012-09-19T12:41:05Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=63992#p63992</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBScript: Добавление записи в реестр в зависимости от переменной]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=63991#p63991" />
			<content type="html"><![CDATA[<p>А когда же учиться?</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2012-09-19T12:16:00Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=63991#p63991</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBScript: Добавление записи в реестр в зависимости от переменной]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=63989#p63989" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>alexii пишет:</cite><blockquote><div class="quotebox"><cite>Бродяга пишет:</cite><blockquote><p>Мда, помощь!!!!</p></blockquote></div><p>«Халява, сэр!»</p></blockquote></div><p>Ты в прошлый раз помог, не откажи и сейчас!</p>]]></content>
			<author>
				<name><![CDATA[Бродяга]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=28174</uri>
			</author>
			<updated>2012-09-19T12:04:55Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=63989#p63989</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBScript: Добавление записи в реестр в зависимости от переменной]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=63988#p63988" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Бродяга пишет:</cite><blockquote><p>Мда, помощь!!!!</p></blockquote></div><p>«Халява, сэр!»</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2012-09-19T12:01:18Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=63988#p63988</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBScript: Добавление записи в реестр в зависимости от переменной]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=63985#p63985" />
			<content type="html"><![CDATA[<p>Мда, помощь!!!!</p>]]></content>
			<author>
				<name><![CDATA[Бродяга]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=28174</uri>
			</author>
			<updated>2012-09-19T11:24:45Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=63985#p63985</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBScript: Добавление записи в реестр в зависимости от переменной]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=63983#p63983" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[Rom5]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5724</uri>
			</author>
			<updated>2012-09-19T09:51:30Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=63983#p63983</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[VBScript: Добавление записи в реестр в зависимости от переменной]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=63981#p63981" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[Бродяга]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=28174</uri>
			</author>
			<updated>2012-09-19T07:17:11Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=63981#p63981</id>
		</entry>
</feed>
