VBS to perform backup of folder in user profile
09/14/2015 2500 views
I'm very new to VBS and I need to create a script that locates if a folder is present under the %userprofile% and if so performs a backup of it just adding a .old in the end of the name. I know how to do this with an active setup, but I was told it is not a good idea to use an active setup for this since we wouldn't be sure the folder was properly backed up.
So I was thinking I could read the users profiles from [HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList], get the list of profiles from there and do a while loop checking if the folder exists and if not, perform a backup of it .
I found this script for the first part but I don't really know how to go from there:
Const HKEY_LOCAL_MACHINE = &H80000002
Set objRegistry=GetObject("winmgmts:\\" & strLocalPC & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList"
objRegistry.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubkeys
For Each objSubkey In arrSubkeys
strValueName = "ProfileImagePath"
strSubPath = strKeyPath & "\" & objSubkey
If you could help me get my theory in a script that would be greatly appreciated :)
Community Chosen Answer
Please log in to answer
I just Googled 'VBS backup user profile'. Take your pick but the 'Windows 7 Migrate User Profiles' hit on StackOverflow looks like a good place to start.
Answered 09/15/2015 by: VBScab