Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Script to Export Multiple registry values?

Reply
 
Old 07-10-2009   #1 (permalink)
Ryan


 
 

Script to Export Multiple registry values?

I am trying to export the Following Keys:
"HKEY_LOCAL_MACHINE\SOFTWARE\VERITAS\NetBackup\CurrentVersion\Config\Browser"

"HKEY_LOCAL_MACHINE\SOFTWARE\VERITAS\NetBackup\CurrentVersion\Config\Client_Name"

"HKEY_LOCAL_MACHINE\SOFTWARE\VERITAS\NetBackup\CurrentVersion\Config\Server"
To a reg file so that i can Import it on another machine.
I have been doing this with a batch file to export them to their own reg
file then import all 3 later.
I would really like to just use VBS, which I am slowly learning.
Can anyone give a hand?
thank you

- Ryan

My System SpecsSystem Spec
Old 07-11-2009   #2 (permalink)
Luuk


 
 

Re: Script to Export Multiple registry values?

Ryan schreef:
Quote:

> I am trying to export the Following Keys:
> "HKEY_LOCAL_MACHINE\SOFTWARE\VERITAS\NetBackup\CurrentVersion\Config\Browser"
>
> "HKEY_LOCAL_MACHINE\SOFTWARE\VERITAS\NetBackup\CurrentVersion\Config\Client_Name"
>
> "HKEY_LOCAL_MACHINE\SOFTWARE\VERITAS\NetBackup\CurrentVersion\Config\Server"
>
> To a reg file so that i can Import it on another machine.
> I have been doing this with a batch file to export them to their own reg
> file then import all 3 later.
> I would really like to just use VBS, which I am slowly learning.
> Can anyone give a hand?
> thank you
>
> - Ryan

no VBS needed

you can do it with:
C:\WINDOWS> REG.EXE /EXPORT
HKLM\SOFTWARE\VERITAS\NetBackup\CurrentVersion\Config somefile.reg

or type "REG EXPORT /?" for more help...

--
Luuk
My System SpecsSystem Spec
Old 07-11-2009   #3 (permalink)
Pegasus [MVP]


 
 

Re: Script to Export Multiple registry values?


"Ryan" <djcalvin@xxxxxx> wrote in message
news:O3oeiIaAKHA.4004@xxxxxx
Quote:

>I am trying to export the Following Keys:
> "HKEY_LOCAL_MACHINE\SOFTWARE\VERITAS\NetBackup\CurrentVersion\Config\Browser"
> "HKEY_LOCAL_MACHINE\SOFTWARE\VERITAS\NetBackup\CurrentVersion\Config\Client_Name"
> "HKEY_LOCAL_MACHINE\SOFTWARE\VERITAS\NetBackup\CurrentVersion\Config\Server"
> To a reg file so that i can Import it on another machine.
> I have been doing this with a batch file to export them to their own reg
> file then import all 3 later.
> I would really like to just use VBS, which I am slowly learning.
> Can anyone give a hand?
> thank you
>
> - Ryan
Extracting registry values with a VB Script is less straightforward that
with a batch file because you must take care of the five possible types of
registry values that exist:
- Reg_SZ
- Reg_Expand_SZ
- Reg_Binary
- Reg_DWord
- Reg_Multi_SZ
The following script is an example of how it could be done. It comes from
here:
http://www.microsoft.com/technet/scr....mspx?mfr=True

Const HKCR=&H80000000, HKCU=&H80000001, HKLM=&H80000002, HKUS=&H80000003
Const REG_SZ = 1
Const REG_EXPAND_SZ = 2
Const REG_BINARY = 3
Const REG_DWORD = 4
Const REG_MULTI_SZ = 7
Const strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Setup"

Set oReg = GetObject("winmgmts:\\.\root\default:StdRegProv")
oReg.EnumValues HKLM, strKeyPath, arrEntryNames, arrValueTypes

For i = 0 To UBound(arrEntryNames)
WScript.Echo "Name: " & arrEntryNames(i)
Select Case arrValueTypes(i)
Case REG_SZ
oReg.GetStringValue HKLM, strKeyPath, arrEntryNames(i),strValue
WScript.Echo "String=" & strValue
Case REG_EXPAND_SZ
oReg.GetExpandedStringValue HKLM, strKeyPath, arrEntryNames(i),
estrValue
WScript.Echo "Expanded String=" & estrValue
Case REG_BINARY
oReg.GetBinaryValue HKLM, strKeyPath, arrEntryNames(i),arrValues
Line = ""
For Each byteValue In arrValues
Line = Line & byteValue
Next
WScript.Echo "Binary=" & Line
Case REG_DWORD
oReg.GetDWORDValue HKLM, strKeyPath, arrEntryNames(i),dwValue
WScript.Echo "DWORD=" & dwValue
Case REG_MULTI_SZ
oReg.GetMultiStringValue HKLM, strKeyPath, arrEntryNames(i), arrValues
Line = ""
For Each strValue In arrValues
Line = Line & strValue & vbLf
Next
WScript.Echo "Multi String=" & Line
End Select
Next


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Set/Create Registry Values PowerShell
Remote HKU registry values PowerShell
Reporting on registry values PowerShell
Export-Csv multiple hashtable values PowerShell
need some registry values Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46