
Loading a registry hive in VBScript
Quote:
> Does anybody know a way to load a registry hive in VBScript? I would
> like to make changes to HKCU for an existing user who is not logged
> on. The only way I would know to accomplish this would be to load the
> hive, make the changes and unload the hive. All suggestions will be
> appreciated.
1. You can shell to the "REG" utility provided in the NT or W2K resource
kits.
Quote:
> C:\> REG LOAD /?
> Registry Console Tool For Windows 2000 - version 2.0
> Copyright (C) Microsoft Corp. 1981-1999. All rights reserved
> REG LOAD KeyName FileName
> KeyName [\\Machine\]FullKey
> Machine Name of remote machine - omitting defaults to the current
> machine
> Only HKLM and HKU are available on remote machines
> FullKey ROOTKEY\SubKey
> ROOTKEY [ HKLM | HKU ]
> SubKey The key name to load the hive file into. Creating a new key
> FileName The name of the hive file to load
> You must use REG SAVE to create this file
> Examples:
> REG LOAD HKLM\TempHive TempHive.hiv
> Loads the file TempHive.hiv to the Key HKLM\TempHive
> REG LOAD \\ZODIAC\HKLM\TempHive Back.hiv
> Loads the file Back.hiv on ZODIAC to the key HKLM\TempHive on ZODIAC
2. If you have the user's password available, you could spawn a task as
that user (using RunAs) to force the system to load the hive.
3. You could defer making the changes to when the user actually does log
in by applying them from a login script.
4. You could laboriously script "REGEDT32" using Sendkeys. Ugh.
--
Ross Presser -- rpresser AT imtek DOT com
"... VB is essentially the modern equivalent of vulgar Latin in 13th
Centurary Europe. Understand it, and you can travel to places you never
heard of and still understand some people." -- Alex K. Angelopoulos