The following vbscript creates a backup of the current users toolbar settings.
It's also possible to target other userprofiles or computers. For this the variables HKEY_CURRENT_USER and strComputer must be customized.
The backupfile will be written at D:\ToolbarBackup.txt
Dim strComputer
Dim objFile, objFSO
Dim objRegistry
Dim strKeyPath
Dim arrValues, strValue
Const HKEY_CURRENT_USER = &H80000001
strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Explorer\Streams\Desktop"
strComputer = "."
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile("D:\ToolbarBackup.txt")
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
objRegistry.GetBinaryValue HKEY_CURRENT_USER,strKeyPath, "TaskbarWinXP",arrValues
For Each strValue In arrValues
objFile.WriteLine strValue
Next
objFile.Close
Set objRegistry = Nothing
Set objFile = Nothing
Set objFSO = Nothing
2. Restore backup of the toolbar settings
To restore the toolbar settings, the following vbscript must be executed. It's important that the explorer.exe is terminated when restoring the settings, because else the settings are discarded.
Dim strComputer
Dim objFile, objFSO
Dim objRegistry
Dim strKeyPath, strValues, arrStrValues, arrValues
Const HKEY_CURRENT_USER = &H80000001
strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Explorer\Streams\Desktop"
strComputer = "."
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("D:\ToolbarBackup.txt")
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strValues=objFile.ReadAll
arrStrValues=Split(strValues, vbCrLf)
ReDim arrValues(UBound(arrStrValues)-1)
for i=0 To UBound(arrStrValues)-1
arrValues(i)=CInt(arrStrValues(i))
Next
For Each Process in GetObject("winmgmts:").ExecQuery ("select * from Win32_Process where name='explorer.exe'")
Process.Terminate(0)
Next
objRegistry.SetBinaryValue HKEY_CURRENT_USER,strKeyPath, "TaskbarWinXP",arrValues
objFile.Close
Set objRegistry = Nothing
Set objFile = Nothing
Set objFSO = Nothing