Reg\_UnloadHive
VB Scripting Library > OSD Scripting Library > Registry Functions (OSD)
Reg_UnLoadHive(sTempHive)
Section titled “Reg_UnLoadHive(sTempHive)”UnLoads an off-line hive loaded into a temp hive in the current registry, using the Reg_LoadHive() function.
Arguments
Section titled “Arguments”| ARGUMENT | DESCRIPTION | TYPE |
|---|---|---|
| sTempHive | The temporary hive name that is to be unloaded | String |
Return Type
Section titled “Return Type”Boolean, TRUE if function completed successfully.
Remarks
Section titled “Remarks”| ⚠️ It is important to unload the hive again after making changes, otherwise it can become corrupted. |
Example
Section titled “Example”The following example will load the HKLM\Software hive from the old operating system to HKLM\TempHive, and the attempt to read the old computername.
Private Function IncludeScript(sScriptFile) '...End Function
'Begin bStatus=True If bStatus Then bStatus=IncludeScript("customlib.cis") If bStatus Then bStatus=IncludeLibrary("Capalib.cin") If bStatus Then bStatus=IncludeLibrary("Osdlib.cin") If bStatus Then bStatus=Job_Start("WS","Script Name","1.0","ScriptName.log","INSTALL") If bStatus Then bStatus=OSD_Initialize()
If bStatus Then bStatus=Reg_LoadHive("HKLM\TempHive","C:\Windows\System32\config\software") If bStatus Then bStatus=Reg_GetString("HKLM","TempHive\CapaSystems\CapaInstaller\Client","ComputerName",False) If bStatus and gsValue <> "" Then bStatus=Dialog_ShowInformation("The old computer name is: " & gsValue) Else bStatus=Dialog_ShowInformation("The old computer name could not be found") End If If bStatus Then bStatus=Reg_UnLoadHive("HKLM\TempHive")
Job_End(bStatus)'End mainSee Also
Section titled “See Also”Scripting Guidelines, Reg_LoadHive, Dialog_ShowInformation