Question : Backup user domain profile locally

hi experts,

with reference to
http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Windows/XP/Q_23181552.html

i would like to achieve the same objective as the author (without using roaming profile), but with a gpo login script in vbs. Let me reiterate the manual steps:

1.  Open regedit, navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
2.  Locate and export the registry key and subkeys matching the user's folder to the local backup location in D drive.  
3.  Copy the user's folder from Documents and Settings to the local backup location in D drive



 
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
' Desktop Backup & My Documents Redirect Registry related methods.

Dim strUserID 
Dim WSHShell

Set WSHNetwork = WScript.CreateObject("WScript.Network")
Set WSHShell = WScript.CreateObject("WScript.Shell")

strUserID = WSHNetwork.UserName

' My Documents Redirect
WSHShell.RegDelete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal"
WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal", "D:\" & strUserID & "\My Documents"
WSHShell.RegDelete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Favorites"
WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Favorites", "D:\" & strUserID & "\My Documents\Favorites"

' Desktop Backup
<insert code here>

Answer : Backup user domain profile locally

Hi,

1) Your question about saving the registry
It would be a bad way to use the regread method from thw WSHShell as you would have to go through every node of the registry. Try this approach instead
http://searchwindowsserver.techtarget.com/tip/0,289483,sid68_gci1039573,00.html

2) "Desktop" Syntax
I used your variable strUserID as you put the person name earlier in your script. Make you if you run mine that you put a value into it. Like this:

Const OverWriteFiles = True
Dim strUserID
Set WSHNetwork = WScript.CreateObject("WScript.Network")
strUserID = WSHNetwork.UserName

Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
objFSO.CopyFolder "C:\Documents and Settings\" & strUserID & "\Desktop", "D:\Backup\" & strUserID, OverWriteFiles

Bye
Random Solutions  
 
programming4us programming4us