' Login script: Copy All Contents of deferred backup to a Share on Network
'
' Author Ishan Karve,
' Version 1.0 - 1st August 2010
' Current Version 1.6 - 16 Nov 10
'
--------------------------------------------------------------------------- -----------------
Option Explicit
Dim svrPath, deferredPath,pc,compname
Dim oShell,objFSO,objFolder,msg,username
Dim folder,subfolder,folderIdx,temp
Set oShell=CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
'get username
username=oShell.ExpandEnvironmentStrings("%USERNAME%")
'define server Path
svrPath="\\xxx.xxx.xxx.xxx\User_Desktop_Backups\" & username & "\desktop_backup\" ' customise to suit requirements
'define deferred path
deferredPath=oShell.ExpandEnvironmentStrings("%HOMEPATH%\deferred")
'Step 1. Check whether deferred folder exists
If objFSO.FolderExists(deferredPath) Then
Wscript.Echo "deferred folder exists.Checking Server Status"
' Step 1.1.1: Check is remote backup server path available
If objFSO.FolderExists(svrPath) Then
Wscript.Echo "Server Online.Copying Folder"
'enumerate local folders
Set folder = objFSO.GetFolder(deferredPath)
Set subfolder = folder.SubFolders
For each folderIdx In subfolder
temp=deferredPath & "\" & folderIdx.Name
'copy folder to server
objFSO.CopyFolder temp ,svrPath
'delete local folder
objFSO.DeleteFolder(temp)
Next
'delete deferred folder
objFSO.DeleteFolder(deferredPath)
Else
Wscript.Echo "Server Offline",svrpath
End If
Else
Wscript.Echo "No deferred folder exists"
End If
Friday, November 19, 2010
Desktop_backup.vbs
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment