1 (изменено: shade45, 2015-12-04 13:50:41)

Тема: VBS: Перевести скрипт на .Reg в скрипт в VB

Есть .reg скрипт для перевода времени на компьютерах c xp.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Ekaterinburg Standard Time]
"Display"="(GMT+05:00) Екатеринбург (RTZ 4)"
"Dlt"="RTZ 4 (лето)"
"Std"="RTZ 4 (зима)"
"MapID"="10,11"
"Index"=dword:000000b4
"TZI"=hex:d4,fe,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Ekaterinburg Standard Time\Dynamic DST]
"2010"=hex:d4,fe,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,0a,00,00,00,05,00,03,00,\
  00,00,00,00,00,00,00,00,03,00,00,00,05,00,02,00,00,00,00,00,00,00
"2011"=hex:d4,fe,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,01,00,06,00,01,00,00,00,\
  00,00,00,00,00,00,00,00,03,00,00,00,05,00,02,00,00,00,00,00,00,00
"FirstEntry"=dword:000007da
"LastEntry"=dword:000007df
"2012"=hex:98,fe,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
"2013"=hex:98,fe,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
"2014"=hex:d4,fe,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,0a,00,00,00,05,00,02,00,\
  00,00,00,00,00,00,00,00,01,00,03,00,01,00,00,00,00,00,00,00,00,00
"2015"=hex:d4,fe,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Russian Standard Time]
"Display"="(GMT+03:00) Волгоград, Москва, Санкт-Петербург (RTZ 2)"
"Dlt"="RTZ 2 (лето)"
"Std"="RTZ 2 (зима)"
"MapID"="6,7"
"Index"=dword:00000091
"TZI"=hex:4c,ff,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Russian Standard Time\Dynamic DST]
"2010"=hex:4c,ff,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,0a,00,00,00,05,00,03,00,\
  00,00,00,00,00,00,00,00,03,00,00,00,05,00,02,00,00,00,00,00,00,00
"2011"=hex:4c,ff,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,01,00,06,00,01,00,00,00,\
  00,00,00,00,00,00,00,00,03,00,00,00,05,00,02,00,00,00,00,00,00,00
"FirstEntry"=dword:000007da
"LastEntry"=dword:000007df
"2012"=hex:10,ff,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
"2013"=hex:10,ff,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
"2014"=hex:4c,ff,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,0a,00,00,00,05,00,02,00,\
  00,00,00,00,00,00,00,00,01,00,03,00,01,00,00,00,00,00,00,00,00,00
"2015"=hex:4c,ff,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00

Пытаюсь сделать его работающим по сети:

Sub TimeZoneChange
	const HKEY_LOCAL_MACHINE = &H80000002
	values = Array(d4,fe,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00)
	values2 = Array(d4,fe,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,0a,00,00,00,05,00,03,00,00,00,00,00,00,00,00,00,03,00,00,00,05,00,02,00,00,00,00,00,00,00)
  values3 = Array(d4,fe,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,01,00,06,00,01,00,00,00,00,00,00,00,00,00,00,00,03,00,00,00,05,00,02,00,00,00,00,00,00,00)
  values4 = Array(98,fe,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00)
  values5 = Array(98,fe,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00)
  values6 = Array(d4,fe,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,0a,00,00,00,05,00,02,00,00,00,00,00,00,00,00,00,01,00,03,00,01,00,00,00,00,00,00,00,00,00)
  values7 = Array(d4,fe,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00)
  values8 = (4c,ff,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00)
  value9 = (4c,ff,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,0a,00,00,00,05,00,03,00,00,00,00,00,00,00,00,00,03,00,00,00,05,00,02,00,00,00,00,00,00,00)
  value10 = (4c,ff,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,01,00,06,00,01,00,00,00,00,00,00,00,00,00,00,00,03,00,00,00,05,00,02,00,00,00,00,00,00,00)
  value11 = (10,ff,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00)
  value12 =(10,ff,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00)
  value13 =(4c,ff,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,0a,00,00,00,05,00,02,00,00,00,00,00,00,00,00,00,01,00,03,00,01,00,00,00,00,00,00,00,00,00)
  value14 =(4c,ff,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00)

	sRemoteComputerName = ComputerName.value
	strKeyPath  = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Ekaterinburg Standard Time"
	strKeyPath2 = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Ekaterinburg Standard Time\Dynamic DST"
	strKeyPath3 = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Russian Standard Time"
	strKeyPath4 = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Russian Standard Time\Dynamic DST"
	Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & sRemoteComputerName & "\root\default:StdRegProv")
	oReg.SetStringValue &H80000002,strKeyPath,"Display","(GMT+05:00) Екатеринбург (RTZ 4)"
	oReg.SetStringValue &H80000002,strKeyPath,"Dlt","RTZ 4 (лето)"
	oReg.SetStringValue &H80000002,strKeyPath,"Std","RTZ 4 (зима)"
	oReg.SetStringValue &H80000002,strKeyPath,"MapID","10,11"
	oReg.SetDWORDValue  &H80000002,strKeyPath,"Index",000000b4
	oReg.SetBINARYValue &H80000002,strKeyPath,"TZI",  values '
	oReg.SetBINARYValue &H80000002,strKeyPath2,"2010",values2
	oReg.SetBINARYValue &H80000002,strKeyPath2,"2011",values3
	oReg.SetDWORDValue  &H80000002,strKeyPath2,"FirstEntry",000007da
	oReg.SetDWORDValue  &H80000002,strKeyPath2,"LastEntry", 000007df
	oReg.SetBINARYValue  &H80000002,strKeyPath2,"2012",values4
	oReg.SetBINARYValue  &H80000002,strKeyPath2,"2013",values5
	oReg.SetBINARYValue  &H80000002,strKeyPath2,"2014",values6
	oReg.SetBINARYValue  &H80000002,strKeyPath2,"2015",values7
	oReg.SetStringValue  &H80000002,strKeyPath3,"Display","(GMT+03:00) Волгоград, Москва, Санкт-Петербург (RTZ 2)"
	oReg.SetStringValue  &H80000002,strKeyPath3,"Dlt","RTZ 2 (лето)"
	oReg.SetStringValue  &H80000002,strKeyPath3,"Std","RTZ 2 (зима)"
	oReg.SetStringValue  &H80000002,strKeyPath3,"MapID","6,7"
	oReg.SetDWORDValue  &H80000002,strKeyPath3,"Index",00000091
	oReg.SetBINARYValue &H80000002,strKeyPath3,"TZI",values8
	oReg.SetBINARYValue &H80000002,strKeyPath4,"2010",value9
	oReg.SetBINARYValue &H80000002,strKeyPath4,"2011",values10
	oReg.SetDWORDValue &H80000002,strKeyPath4,"FirstEntry",000007da
	oReg.SetDWORDValue &H80000002,strKeyPath4,"LastEntry",000007df
	oReg.SetBINARYValue &H80000002,strKeyPath4,"2012",values11
	oReg.SetBINARYValue &H80000002,strKeyPath4,"2013",values12
	oReg.SetBINARYValue &H80000002,strKeyPath4,"2014",values13
	oReg.SetBINARYValue &H80000002,strKeyPath4,"2015",values14
	End sub

Ругается на строчку где есть, значение - 0a, можно ли это решить?


Reg:
"2010"=hex:d4,fe,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,0a,00,00,00,05,00,03,00,\
  00,00,00,00,00,00,00,00,03,00,00,00,05,00,02,00,00,00,00,00,00,00

VB:
values2 = Array(d4,fe,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,0a,00,00,00,05,00,03,00,00,00,00,00,00,00,00,00,03,00,00,00,05,00,02,00,00,00,00,00,00,00)

2

Re: VBS: Перевести скрипт на .Reg в скрипт в VB

А че это за значение такое? В VB пишут &H0a. Ну или в десятичные числа переводи.

3 (изменено: shade45, 2015-12-04 13:57:36)

Re: VBS: Перевести скрипт на .Reg в скрипт в VB

mozers это hex значения из .reg, сейчас поправлю

4 (изменено: shade45, 2015-12-07 13:45:37)

Re: VBS: Перевести скрипт на .Reg в скрипт в VB

решено