Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Backup Registry Key with VBScript

657 views
Skip to first unread message

Link

unread,
Jan 21, 2003, 5:42:28 AM1/21/03
to
Hi,
how can i export a registry key with vbscript???

please help

Torgeir Bakken (MVP)

unread,
Jan 21, 2003, 7:49:03 AM1/21/03
to
Link wrote:

> Hi,
> how can i export a registry key with vbscript???

You can use the built in command line util regedit.exe: From your script, make a
callout to regedit to export the registry branch to a text file.

In the link below, there are some code that covers this.

From: Alex K. Angelopoulos \(MVP\) (a...@mvps.org)
Subject: Re: Rename reg keys
Newsgroups: microsoft.public.scripting.vbscript
Date: 2002-11-02 12:50:03 PST
http://groups.google.com/groups?selm=%23oJuTBrgCHA.1952%40tkmsftngp09

Also, if you have access to the NT/Win2k resource kit, Reg.exe can be used
(doesn't work on Win9x/Me). Note that this will not create a registry file
structure on the "export":

Example:

REG.EXE QUERY HKLM\Software\Microsoft\ResKit\Setup /S
Displays all keys and values under the Setup sub-key.
/S, /s Queries all subkeys.

To redirect it to a file:

sBackupFile = "some file path here"
sRegPath = "HKLM\Software\Microsoft\ResKit\Setup"

Set oShell = CreateObject("WScript.Shell")
oShell.Run "%comspec% /c reg.exe QUERY " _
& Chr(34) & sRegPath & Chr(34) _
& " /S >" & sBackupFile, 0, True


--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and a ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter


0 new messages