Solved

VBScript - Dictionary Objects(maps) mapping to Arrays (vb Arrays)

Posted on 2009-04-12
13
3,079 Views
Last Modified: 2013-12-20
Greetings,
I have a script that I have, and it works...but I have eight other groups that do the exact same thing but they need a different Root path to run it from.  If I had a way
1.  Prompt the user what bussiness group they belonged to.
2.  That respone information and the variable strParentFolder each time it is run.   If I could do that I would be able to service all Nine groups with just this one same script.

- everyone shares this root path: CONST ROOT_STORAGE_Path = \\deptsvr\raining.  
-there are 9 folders that are built:     (0) = CONST ROOT_STORAGE_Path
                                                          (1) = CONST ROOT_STORAGE_Path  & "_Sales"
                                                          (2) = CONST ROOT_STORAGE_Path  & "_Processing"
                                                          (3) = CONST ROOT_STORAGE_Path  & "_Service"
                                                          (4) = CONST ROOT_STORAGE_Path  & "_Commercial"
                                                          (5) = CONST ROOT_STORAGE_Path  & "_Claims"
                                                          (6) = CONST ROOT_STORAGE_Path  & "_Tech"
                                                          (7) = CONST ROOT_STORAGE_Path  & "_Spec"
                                                          (8) = CONST ROOT_STORAGE_Path  & "_Accouting"


- I need to get a map to of: Location => Array of Dept folders
-I need a map of locations and then somehow map that to a list of items (dept folders).
-From what reasearch I can find it seems that  that I need to do this with dictionary objects(Maps) mapping to Arrays (vb Arrays).  I see two things suggested
                        a. map an array to one item in a map(dictionary object),
                        b.  have a map of locations mapping to a map of depts folders.
I kind of get the concept but I don't understand where to start.  Reasearching the answers on this site I found something that can get me started with setting up the array, but I know how to tie it all together for what I am trying to do:

' Declare the Array and ReDim it to give it a size
Dim oDictionaryArray()
ReDim oDictionaryArray(5)
 
' Iterate thru each "slot" in the Array and place a Dictionary in it
For i = 0 To UBound(oDictionaryArray)
    Set oDictionaryArray(i) = CreateObject("Scripting.Dictionary")
 
    ' Put something different into each Dictionary in the Array
    oDictionaryArray(i).Add "Name", "Dictonary" & i
Next
 
' Show a value from one of the Arrays
Index = 2
WScript.Echo oDictionaryArray(Index).Item("Name") ' Should be "Dictionary2"

Can someone help me?



0
Comment
Question by:aceklub97
  • 6
  • 6
13 Comments
 
LVL 67

Expert Comment

by:sirbounty
ID: 24127637
Hmm - I think what you're looking for is something like:

CONST ROOT_STORAGE_Path = "\\deptsvr\raining"

arrPaths = Array ("_Sales","_Processing","_Service","_Commercial","_Claims","_Tech","_Spec","_Accouting")
 

Dim objDictionary : Set objDictionary = CreateObject("Scripting.Dictionary")

With objDictionary

 .Add ROOT_STORAGE_Path, Nothing

 For each p in arrPaths

   .Add ROOT_STORAGE_Path & p, Nothing

 Next

End With

Open in new window

0
 
LVL 22

Expert Comment

by:danaseaman
ID: 24129141
Why not just use Split instead of Dictionary object?

Option Explicit
 

'Sample Usage:

'Call MyScript(2) 'where 2 is "_Processing"
 

Private arrPaths() As String
 

Private Sub Form_Load()

   arrPaths = Split(Array("\\deptsvr\raining", "_Sales", "_Processing", "_Service", "_Commercial", "_Claims", "_Tech", "_Spec", "_Accouting"), ",")

End Sub
 

Sub MyScript(iPath)

   Dim myPath

   If iPath = 0 Then

      myPath = arrPaths(iPath)

   Else

      myPath = arrPaths(0) & "\" & arrPaths(iPath)

   End If

   'script code goes here

End Sub

Open in new window

0
 

Author Comment

by:aceklub97
ID: 24133431
Ok I am looking at both examples, they both make sense but I am still confused about how I pull the informattion into the script so that I can determine the start path. I am includeing The start of my actual script.  This works for the one group with the one starting places.    I am running an .hta files that is calling the script.  Is it possible to use either method to make a drop down that allows the customer to pick the correct business group which sets the correct start location and then proceed with the rest of the script?  Thanks for the help so far,  I am just having trouble leaning how to tie it all together.

Const ROOT_STORAGE_PATH = "\\deptsvr\Training"

...

Dim variables

' Get main object instance

...

'Prompt the customer for user input:
' Right now with the working script I ask the user what their trainers name is and it creates the folder
'  What I need to figure out is how add one extra prompt or pull down menu to use one of the methods given me to set strParentFolder blow each time the script is run.

strParentFolder = "\\deptsvr\training\"      ' This is the variable I need to be set each time the script is run
If Right(strParentFolder, 1) = "\" Then strParentFolder = Left(strParentFolder, Len(strParentFolder) - 1)
strMessage = "Please enter the number that corresponds to your trainer:" & VbCrLf
intNum = 0

      For Each objSubFolder In objFSO.GetFolder(strParentFolder).SubFolders
            intNum = intNum + 1
            strMessage = strMessage & VbCrLf & intNum & ": " & objSubFolder.Name
            objTrainers.Add intNum, objSubFolder.Name
      Next
strResponse = InputBox(strMessage, "Select Trainer")
backupOrRestoreResponse = InputBox("Type a 0 for Backup, a 1 for Restore", "Select Operation")

If IsNumeric(strResponse) = True Then
      intResponse = CInt(strResponse)
      If intResponse >=1 And intResponse <= intNum Then
            
            strUsername = objNetwork.UserName
            strBackupFolder = strParentFolder & "\" & objTrainers(intResponse) & "\" & strUsername & "\"

0
 
LVL 22

Expert Comment

by:danaseaman
ID: 24134697
Try something like this.
Changed strParentFolder to "C:\deptsvr\Training\" for testing.

Option Explicit
 

Private Sub Form_Load()

   Dim strParentFolder

   Dim strMessage

   Dim intNum

   Dim strResponse

   Dim intResponse

   Dim objFSO

   Dim objSubFolder

   Dim arrTrainers

   

   Set objFSO = CreateObject("Scripting.FileSystemObject")
 

   strParentFolder = "C:\deptsvr\Training\"  '"\\deptsvr\Training\"
 

   ReDim arrTrainers(0)

   strMessage = "Please enter the number that corresponds to your trainer:"

   arrTrainers(0) = strMessage
 

   For Each objSubFolder In objFSO.GetFolder(strParentFolder).SubFolders

      intNum = intNum + 1

      strMessage = strMessage & vbCrLf & intNum & ": " & objSubFolder.Name

      ReDim Preserve arrTrainers(intNum)

      arrTrainers(intNum) = objSubFolder.Name

   Next
 

   strResponse = InputBox(strMessage, "Select Trainer")

   If IsNumeric(strResponse) Then

      intResponse = CInt(strResponse)

      If intResponse >= 1 And intResponse <= intNum Then

         Debug.Print strParentFolder & arrTrainers(intResponse)

      Else

         Debug.Print "Invalid option. Numbers only or out of bounds."

      End If

   End If

End Sub

Open in new window

0
 

Author Comment

by:aceklub97
ID: 24137291
Ok sorry about my being so dense.  I am still new to this.   This is helping, but this last post is changing me initial script, when I try to test it, but I don't what that.  All I want is to be able to call my array to determine what the strParentFolder is.   I already have the 9 directories created that mirror the default strParenetFolder that I have working correctly.  I simply need a way to service all 9 groups with the same script, and not having to write all 9 scripts.  sirBounty's post sets up the array that I need that deals with all 9 locations, but I am confuses with how to  invoke that array to change str

strParentFolder = "\\deptsvr\training\"      ' This is the variable I need to be set each time the script is run
' I need this to be change to "\\deptsvr\Training_Sales" \\deptsvr\Training_Processing" etc. on down the line, and then process the script as normal.  All 9 directories already have the individual trainers for that department already loaded into them it script should work the same for the other 8 Locations as it now does for the default
0
 
LVL 22

Expert Comment

by:danaseaman
ID: 24137480
Try this:
strParentFolder = "\\deptsvr\training\" & arrTrainers(intResponse)
'script code goes here
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 22

Expert Comment

by:danaseaman
ID: 24137536
Aren't these subfolders?
i.e. "\\deptsvr\Training_Sales" should be "\\deptsvr\Training\_Sales" ?
0
 
LVL 22

Expert Comment

by:danaseaman
ID: 24137655
There may also be an error in FSO code where you are looking for subfolders of strParentFolder = "\\deptsvr\training\" .
Perhaps it should be looking in strParentFolder = "\\deptsvr\".
Can you show the actual folder structure?
0
 

Author Comment

by:aceklub97
ID: 24137978
ok let me try to put your post together.  Let me know if I am on the correct path:

Option Explicit
Private arrPaths() As String
 
Private Sub Form_Load()
   arrPaths = Split(Array("\\deptsvr\raining", "_Sales", "_Processing", "_Service", "_Commercial", "_Claims", "_Tech", "_Spec", "_Accouting"), ",")
End Sub
 
Sub MyScript(iPath)
   Dim myPath
   If iPath = 0 Then
      myPath = arrPaths(iPath)
   Else
      myPath = arrPaths(0) & "\" & arrPaths(iPath)
   End If
   strParentFolder = "\\deptsvr\training\" & arrTrainers(intResponse
(start script here)
End Sub

Maybe this will make it easier.   I have attached my entire code below.  This behaves exactly Like I want it to do for one customer base.  I am trying to get it to work for all 9 and only have them
Option Explicit
 

'LG: BEGIN SCRIPT ****************************************************************************************

'CONSTANT DECLARATIONS

Const ROOT_STORAGE_PATH = "\\deptsvr\Training"

Const DATE_AND_TIME_REQUIRED = True ' Change to False if you do not want the date and time in the destination folder

Const FOR_READING = 1, FOR_WRITING = 2, FOR_APPENDING = 8 

Const CONVERSION_FACTOR = 1024

Const ROOT_RESTORE_PATH = "C:\"
 

'VARIABLE DECLARATIONS *************************************************************************
 

Dim fso, network, fs, shell, file, files, folder, folders, lotusNotesINIPath 

Dim favoritesFolderPath, desktopFolderPath, myDocumentsFolderPath, objShell

Dim lotusNotesFolderPath, passportFolderPath, userName, log_file_handle, fldr

Dim objFSO, strParentFolder, strMessage, IntNum, objTrainers, objSubFolder

Dim strResponse, intResponse, strUsername, strBackupFolder, objNetwork, NewPath

Dim Message, Title, result, WSHShell, lotusNotes8FolderPath, backupOrRestoreResponse 

Dim Rename, strMoveResult, lotusNotes8INIFolderPath, lotuNotes8NotesDataBackup, strUserProfile

Dim strComputer, ccpulseFolerPath, msofficePath, ccpulseSupINIPath, awdviewPathFolder

Dim awdwinfilesPathFolder, awdaisPath1Folder, awdaisPath2Folder, awdbidbPathFolder

Dim voyagerPathFolder, lotusNotesClassFolderPath, lotusNotesINIClassPath, ClarityViewsPathFolder

Dim sametimePathFolder, sametimeChatPathFolder, xactimateDBPathFolder, xactimateDataPathFolder

Dim attachmateClassPath, attachmateNSCPathFolder, mitchellAIMPath, folder1, folder2, folder3

Dim classIbmFolderPath, classFolderPath, classImageFolderPath, classWinRappFolderPath

Dim mitchellUserauxPathFolder, mitchellSecusvrPathFolder, mitchellAcesExpPathFolder, mitchellCommsvrPathFolder

Dim mitchellSysconPathFolder, mitchellProgPathFolder, folder4, mitchellAcesLexPathFolder

Dim folder5, folder6, mitchellProgramsEclaimPathFolder, mitchellProgramsTruckEst, mitchellProgramsTruckEstPathFolder

Dim ibmsWinsSessionsFolderPath, softphoneProfileFolderPath, cccpathwaysConfigFolderPath, cccpathwaysDataFolderPath

Dim cccpathwaysDatamgrFolderPath, cccpathwaysUpdsavFolderPath, cccpathwaysPCE, mitchellFolderPath

Dim mitchellProgramsFolderPath, cccpathwaysFolderPath, folder7

Dim strHomeFolder, strHome, strUser, intRunError
 

'Get main object instances

Set fso     = wscript.createobject("Scripting.FileSystemObject")

Set shell   = wscript.createobject("wscript.shell")

Set network = wscript.createobject("wscript.network")

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objTrainers = CreateObject("Scripting.Dictionary")

Set objNetwork = CreateObject("WScript.Network")

Set objShell = CreateObject("WScript.Shell")
 

'Get vbs special folder paths

favoritesFolderPath   = shell.SpecialFolders.Item("Favorites")

desktopFolderPath     = shell.SpecialFolders.Item("Desktop")

myDocumentsFolderPath = shell.SpecialFolders.Item("MyDocuments")
 

' Get other directory folder paths

lotusNotesFolderPath = "C:\Progra~1\Lotus\Notes\Data"

lotusNotesINIPath = "C:\Progra~1\Lotus\Notes\"

passportFolderPath = "C:\Progra~1\Passport"

strUserProfile = objShell.ExpandEnvironmentStrings("%USERPROFILE%")

lotusNotes8FolderPath = strUserProfile & "\local settings\application data\lotus\Notes\Data"

lotusNotes8INIFolderPath = "C:\Documents and Settings\All Users\Application Data\Lotus\Notes\data"

lotuNotes8NotesDataBackup = "C:\Documents and Settings\NotesDataBackup"

ccpulseFolerPath = "C:\GCTI"

msofficePath = strUserProfile & "\applic~1\micros~1\proof\"

ccpulseSupINIPath = "C:\WINXP\"

awdviewPathFolder = "c:\awdview\bin\"

awdwinfilesPathFolder = "c:\awdwin\files"

awdaisPath1Folder = "c:\AIS"

awdaisPath2Folder = "c:\AIS"

awdbidbPathFolder = "c:\program files\awdbi\datamart\"

voyagerPathFolder = "c:\Winxp\"

lotusNotesClassFolderPath = "C:\Programs\Notes\Data"

lotusNotesINIClassPath = "C:\Programs\Notes\Data\"

ClarityViewsPathFolder = "C:\program files\open workbench\views"

sametimePathFolder = strUserProfile & "\SametimeTranscripts"

sametimeChatPathFolder = strUserProfile & "\SavedChats"

xactimateDBPathFolder = "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\"

xactimateDataPathFolder = "C:\Documents and Settings\All Users\Application Data\Xactware\Xactimate25"

attachmateClassPath = "c:\programs\person~1\private\"

attachmateNSCPathFolder = "c:\program files\attachmate\extra!\Sessions"

mitchellAIMPath = "c:\progra~1\mitchell\aim\custom"

classFolderPath = "c:\class"

classIbmFolderPath = "c:\progra~1\ibm\source\c44j9ml\"

classImageFolderPath = "c:\images"

classWinRappFolderPath = "c:\programs\rapp\rptspecs"

mitchellProgramsFolderPath = "c:\Progra~1\Mitchell"

mitchellFolderPath = "c:\Mitchell"

mitchellUserauxPathFolder = "C:\mitchell\useraux\"

mitchellProgPathFolder = "c:\progra~1\mitchell\"

mitchellSecusvrPathFolder = "c:\mitchell\secusvr\"

mitchellAcesExpPathFolder = "c:\mitchell\aces\longexp\"

mitchellAcesLexPathFolder = "c:\mitchell\aces\lexicon\"

mitchellCommsvrPathFolder = "c:\mitchell\commsvr"

mitchellSysconPathFolder = "c:\mitchell\syscon\"

mitchellProgramsEclaimPathFolder = "c:\progra~1\mitchell\eclaim\"

mitchellProgramsTruckEstPathFolder = "c:\progra~1\mitchell\truckest"

ibmsWinsSessionsFolderPath = "C:\progra~1\ibm\client Access\Emulator\Private"

softphoneProfileFolderPath = strUserProfile 

cccpathwaysFolderPath = "c:\programs\Pathways"

cccpathwaysConfigFolderPath = "C:\programs\Pathways\Config"

cccpathwaysDataFolderPath = "c:\PROGRAMS\PATHWAYS\DATA"

cccpathwaysDatamgrFolderPath = "c:\PROGRAMS\PATHWAYS\DATAMGR"

cccpathwaysUpdsavFolderPath = "c:\PROGRAMS\PATHWAYS\UPDSAV"

cccpathwaysPCE = "c:\WINXP\PATHWAYS\PCE"
 

'Get user name of currently logged on user

userName = network.UserName
 
 

'Prompt the customer for user input:

 

' 1. Ask the customer what trainer they are under

' 2. Create a folder that has the format: \\deptsvr\Training\%Trainer%\%USERPROFILE%.

' 3. Ask the customer whether they want to backup for restore.
 

strParentFolder = "\\deptsvr\training\"

If Right(strParentFolder, 1) = "\" Then strParentFolder = Left(strParentFolder, Len(strParentFolder) - 1)

strMessage = "Please enter the number that corresponds to your trainer:" & VbCrLf

intNum = 0
 

	For Each objSubFolder In objFSO.GetFolder(strParentFolder).SubFolders

		intNum = intNum + 1

		strMessage = strMessage & VbCrLf & intNum & ": " & objSubFolder.Name

		objTrainers.Add intNum, objSubFolder.Name

	Next

strResponse = InputBox(strMessage, "Select Trainer")

backupOrRestoreResponse = InputBox("Type a 0 for Backup, a 1 for Restore", "Select Operation")
 

If IsNumeric(strResponse) = True Then

	intResponse = CInt(strResponse)

	If intResponse >=1 And intResponse <= intNum Then

		

		strUsername = objNetwork.UserName

		strBackupFolder = strParentFolder & "\" & objTrainers(intResponse) & "\" & strUsername & "\"

	

' This is where we use the backupOrRestoreResponse Inbox we declared earlier.

'**************************************************************************************************************
 

If backupOrRestoreResponse = 0 Then

	executeBackup

	executePermissions

	ElseIf backupOrRestoreResponse = 1 Then

	executeRestore

	deleteBackup

	Else

	MsgBox "You did not enter a valid number."	

End If	

  Else

     MsgBox "You did not enter a valid number."

  End If

Else

    MsgBox "You did not enter a valid number."

End If
 

Set fso = Nothing

Set Shell = Nothing 

Set network = Nothing

Set objFso = Nothing

Set objTrainers = Nothing

Set objNetwork = Nothing 

Set objShell   = Nothing
 

'FUNCTIONS ****************************************************************************************************

' 1. If 0 is is selected, then the Backup function will run.
 

Function executeBackup()

'- Create the master backup folder strBackupFolder

	On error resume next

Set folder = fso.createfolder(strBackupFolder)

 if folder is nothing then

     'This folder exists

 else

     'folder created

 end If

 			      

    	

 MsgBox "Please close all applications and windows before continuing with the process."
 

' Create log file - (This part makes a date/time "3/2/2008 10:23:09" into "2_2_2008 1-_23_09")

Set log_file_handle = fso.OpenTextFile(folder.path & "\backup_" & replace(replace(FormatDateTime(Now,0),"/","_"),":","_") & ".log", FOR_APPENDING, True)

log_file_handle.writeline "***** Begin run at: " & now & " *****"

log_file_handle.writeline vbnewline
 

' - Creating Subfolders when  the entire directory can't be copied: strBackupFolder\subdirectory
 

' - Notes6  .ini files

If Not fso.FolderExists(strBackupFolder & "\Notes6INI\") Then

	Set folder1 = fso.Createfolder(strBackupFolder & "\Notes6INI\")

End If

' - MS Office .dic files

If Not fso.FolderExists(strBackupFolder & "\MSOffice\") Then

	Set folder2 = fso.Createfolder(strBackupFolder & "\MSOffice\")

End If

'- AWD AIS

If Not fso.FolderExists(strBackupFolder & "\AIS") Then

	Set folder3 = fso.Createfolder(strBackupFolder & "\AIS")

End If

'- AWD View

If Not fso.FolderExists(strBackupFolder & "\AWDView\") Then

	Set folder4 = fso.Createfolder(strBackupFolder & "\AWDView\")

End If

'- Notes 6 Class .ini files

If Not fso.FolderExists(strBackupFolder & "\Notes6ClassINI\") Then

	Set folder5 = fso.Createfolder(strBackupFolder & "\NotesClass6INI\")

End If

'- Class IBM

' - Softphone

If Not fso.FolderExists(strBackupFolder & "\Softphone\") Then

	Set folder6 = fso.Createfolder(strBackupFolder & "\Softphone\")

End If
 

'BACKUP FOLDERS *************************************************************************************
 

' - Favorites

log_file_handle.writeline now & " Backing up favorites..." 

log_file_handle.writeline now & " Output Drive Freespace GB: Before " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

fso.copyfolder favoritesFolderPath, folder.path & "\Favorites", true

log_file_handle.writeline now & " Output Drive Freespace GB: After " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

log_file_handle.writeline vbnewline
 

' - My Documents

log_file_handle.writeline now & " Backing up my documents..."

log_file_handle.writeline now & " Output Drive Freespace GB: Before " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

fso.copyfolder myDocumentsFolderPath, folder.path & "\My Documents", true

log_file_handle.writeline now & " Output Drive Freespace GB: After " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

log_file_handle.writeline vbnewline
 

' - Desktop 

log_file_handle.writeline now & " Backing up desktop..."

log_file_handle.writeline now & " Output Drive Freespace GB: Before " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

fso.copyfolder desktopFolderPath, folder.path & "\Desktop", true

log_file_handle.writeline now & " Output Drive Freespace GB: After " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

log_file_handle.writeline vbnewline
 

' - Lotus Notes 6

log_file_handle.writeline now & " Backing up Lotus Notes 6..."

log_file_handle.writeline now & " Output Drive Freespace GB: Before " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

fso.copyfolder lotusNotesFolderPath, folder.path & "\Notes6Data", True

fso.CopyFile "C:\Progra~1\Lotus\Notes\notes.ini" ,  strBackupFolder & "\Notes6INI\"

log_file_handle.writeline now & " Output Drive Freespace GB: After " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

log_file_handle.writeline vbnewline
 

' - Passport

log_file_handle.writeline now & " Backing up Passport..."

log_file_handle.writeline now & " Output Drive Freespace GB: Before " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

fso.copyfolder passportFolderPath, folder.path & "\Passport", true

log_file_handle.writeline now & " Output Drive Freespace GB: After " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

log_file_handle.writeline vbnewline
 

' - Softphone

log_file_handle.writeline now & " Backing up Softphone..."

log_file_handle.writeline now & " Output Drive Freespace GB: Before " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

fso.CopyFile softphoneProfileFolderPath & "\MCR-273 Softphone - Policy2.ebm" , strBackupFolder & "\Softphone\"

fso.CopyFile softphoneProfileFolderPath & "\PassportScreenPopFX52.exe" ,  strBackupFolder & "\Softphone\"

fso.CopyFile softphoneProfileFolderPath & "\softphone.ini" ,  strBackupFolder & "\Softphone\"

fso.CopyFile softphoneProfileFolderPath & "\SoftPolicy.txt" ,  strBackupFolder & "\Softphone\"

fso.CopyFile softphoneProfileFolderPath & "\UnifiedSoftPhone.log" , strBackupFolder & "\Softphone\"

log_file_handle.writeline now & " Output Drive Freespace GB: After " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

log_file_handle.writeline vbnewline
 

' - Lotus Notes 8

log_file_handle.writeline now & " Backing up Lotus Notes 8..."

log_file_handle.writeline now & " Output Drive Freespace GB: Before " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

fso.copyfolder lotusNotes8FolderPath, folder.path & "\Notes8ProfileData", True

fso.copyfolder lotusNotes8INIFolderPath, folder.path & "\Notes8AllUsersData", True

fso.copyfolder lotuNotes8NotesDataBackup, folder.path & "\Notes8NotesDataBackup", True

log_file_handle.writeline now & " Output Drive Freespace GB: After " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

log_file_handle.writeline vbnewline
 

' - Sametime

log_file_handle.writeline now & " Backing up Sametime..."

log_file_handle.writeline now & " Output Drive Freespace GB: Before " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

fso.copyfolder sametimePathFolder,  folder.path & "\SametimeTranscipts", True

fso.copyfolder sametimeChatPathFolder, folder.path & "\SametimeSavedChats", True

log_file_handle.writeline now & " Output Drive Freespace GB: After " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

log_file_handle.writeline vbnewline
 

' - CC Pulse

log_file_handle.writeline now & " Backing up CC Pulse..."

log_file_handle.writeline now & " Output Drive Freespace GB: Before " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

fso.copyfolder ccpulseFolerPath, folder.path & "\CCPulse", True

fso.CopyFile "C:\Winxp\icewin.ini" ,  strBackupFolder   

log_file_handle.writeline now & " Output Drive Freespace GB: After " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

log_file_handle.writeline vbnewline
 

' - MS Office

log_file_handle.writeline now & " Backing up Microsoft Office..."

log_file_handle.writeline now & " Output Drive Freespace GB: Before " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

fso.CopyFile strUserProfile & "\applic~1\micros~1\proof\custom.dic" ,  strBackupFolder & "\MSOffice\" 

log_file_handle.writeline now & " Output Drive Freespace GB: After " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

log_file_handle.writeline vbnewline
 

' - AWD

log_file_handle.writeline now & " Backing up AWD..."

log_file_handle.writeline now & " Output Drive Freespace GB: Before " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

fso.copyfolder awdwinfilesPathFolder, folder.path & "\AWD", True

fso.CopyFile "c:\awdview\bin\vm.cfg" ,  strBackupFolder  & "\AWDView\"

fso.CopyFile "c:\AIS\AWDCommon.ini" , strBackupFolder & "\AIS\" 

fso.CopyFile "c:\AIS\VBEXITPPORT.ini" , strBackupFolder  & "\AIS\"

log_file_handle.writeline now & " Output Drive Freespace GB: After " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

log_file_handle.writeline vbnewline
 

' AWD BI

log_file_handle.writeline now & " Backing up BI Datamart..."

log_file_handle.writeline now & " Output Drive Freespace GB: Before " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

fso.CopyFile "c:\program files\awdbi\datamart\bi.mdb" , strBackupFolder  

fso.CopyFile "c:\program files\awdbi\datamart\cust*.rpt" , strBackupFolder  

log_file_handle.writeline now & " Output Drive Freespace GB: After " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

log_file_handle.writeline vbnewline
 

' Voyager

log_file_handle.writeline now & " Backing up Voyager..."

log_file_handle.writeline now & " Output Drive Freespace GB: Before " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

fso.CopyFile "c:\winxp\cbrt.ini" , strBackupFolder  

fso.CopyFile "c:\winxp\windart.ini" , strBackupFolder  

log_file_handle.writeline now & " Output Drive Freespace GB: After " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

log_file_handle.writeline vbnewline
 

' - Lotus Notes 6 CLASS

log_file_handle.writeline now & " Backing up CLASS Lotus Notes 6..."

log_file_handle.writeline now & " Output Drive Freespace GB: Before " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

fso.copyfolder lotusNotesClassFolderPath , folder.path & "\Notes6DataClass", True

fso.CopyFile "C:\Programs\Notes\notes.ini" ,  strBackupFolder & "\NotesClass6INI\"

log_file_handle.writeline now & " Output Drive Freespace GB: After " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

log_file_handle.writeline vbnewline
 
 

' - Clarity Workbench

log_file_handle.writeline now & " Backing up Clarity Workbench..."

log_file_handle.writeline now & " Output Drive Freespace GB: Before " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

fso.copyfolder ClarityViewsPathFolder , folder.path & "\Clarity" , True 

log_file_handle.writeline now & " Output Drive Freespace GB: After " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

log_file_handle.writeline vbnewline
 

' - Xactimate

log_file_handle.writeline now & " Backing up Xactimate..."

log_file_handle.writeline now & " Output Drive Freespace GB: Before " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

fso.CopyFile "C:\program files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\xm8_*.*" , strBackupFolder

'folder2 = Shell.Run("CMD /C xcopy """ & xactimateDBPathFolder & """ """ & strBackupFolder & "\XactimateDB"" /e /y >""C:\program files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\xm8_*.*""")

fso.copyfolder xactimateDataPathFolder , folder.path & "\XactimateData", True

log_file_handle.writeline now & " Output Drive Freespace GB: After " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

log_file_handle.writeline vbnewline
 

' - Attachmat 3270 Sessions

log_file_handle.writeline now & " Backing up Attachmate 3270 Sessions..."

log_file_handle.writeline now & " Output Drive Freespace GB: Before " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

fso.CoypFile "c:\programs\person~1\private\*.ws" , strBackupFolder 

fso.copyfolder attachmateNSCPathFolder , folder.path & "\3270Sessions", True

log_file_handle.writeline now & " Output Drive Freespace GB: After " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

log_file_handle.writeline vbnewline
 

' - Mitchell AIM

log_file_handle.writeline now & " Backing up Mitchell AIM..."

log_file_handle.writeline now & " Output Drive Freespace GB: Before " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

fso.copyfolder mitchellAIMPath , folder.path & "\MitchellAIM", True

log_file_handle.writeline now & " Output Drive Freespace GB: After " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

log_file_handle.writeline vbnewline
 

' - Class 

log_file_handle.writeline now & " Backing up Class..."

log_file_handle.writeline now & " Output Drive Freespace GB: Before " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

fso.copyfolder classFolderPath, folder.path & "\Class", True

fso.CopyFile "c:\progra~1\ibm\source\c44j9ml\pcfile.tst", strBackupFolder  

fso.copyfolder classImageFolderPath, folder.path & "\ClassImages", True

fso.copyfolder classWinRappFolderPath, folder.path & "\ClassWinRapp", True

fso.CopyFile "c:\winxp\rapp.ini", strBackupFolder & "\CalssWinRapp\"

log_file_handle.writeline now & " Output Drive Freespace GB: After " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

log_file_handle.writeline vbnewline
 

' - Mitchell Suite

log_file_handle.writeline now & " Backing up Attachmate 3270 Sessions..."

log_file_handle.writeline now & " Output Drive Freespace GB: Before " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

fso.copyfolder mitchellFolderPath, folder.path & "\MitchellRoot", True

fso.copyfolder mitchellProgramsFolderPath, folder.path & "\MitchellPrograms", True

log_file_handle.writeline now & " Output Drive Freespace GB: After " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR

Open in new window

0
 

Author Comment

by:aceklub97
ID: 24138029
It cut me off.  Here is the rest of the script


' - CCC Pathways
log_file_handle.writeline now & " Backing up CCC Pathways..."
log_file_handle.writeline now & " Output Drive Freespace GB: Before " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)
fso.copyfolder cccpathwaysFolderPath , folder.path & strBackupFolder & "\Pathways", True
'fso.copyfolder cccpathwaysDataFolderPath, folder.path & strBackupFolder & "\PathwaysData", True
'fso.copyfolder cccpathwaysDatamgrFolderPath, folder.path & strBackupFolder & "\PathwaysDataMgr", True
'fso.copyfolder cccpathwaysUpdsavFolderPath, folder.path & strBackupFolder & "\PathwaysUpdsav", True
'fso.CopyFile "c:\PROGRAMS\PATHWAYS\WFMGR\CONFIG.IB", strBackupFolder & "\PathwaysWFMGR\"
'fso.CopyFile "c:\PROGRAMS\PATHWAYS\WFMGR\CONFIGX.IB", strBackupFolder & "\PathwaysWFMGR\"
'fso.CopyFile "c:\PROGRAMS\PATHWAYS\WFMGR\CONFIGMGR.IB", strBackupFolder & "\PathwaysWFMGR\"
'fso.CopyFile "c:\PROGRAMS\PATHWAYS\WFMGR\INSTLUPD.IB", strBackupFolder & "\PathwaysWFMGR\"
'fso.CopyFile "c:\PROGRAMS\PATHWAYS\WFMGR\MGRSWMOD.IB", strBackupFolder & "\PathwaysWFMGR\"
'fso.CopyFile "c:\PROGRAMS\PATHWAYS\WFMGR\PATHWAYS.INI", strBackupFolder & "\PathwaysWFMGR\"
'fso.copyfolder cccpathwaysPCE, folder.path & strBackupFolder & "\PathwaysPCE", True
'fso.CopyFile "c:\PROGRAMS\PATHWAYS\LOCAL\PWYLOC32.IB", strBackupFolder
log_file_handle.writeline now & " Output Drive Freespace GB: After " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)
log_file_handle.writeline vbnewline

'-  IBM I-Series WINS Sessions
log_file_handle.writeline now & " Backing up WINS..."
log_file_handle.writeline now & " Output Drive Freespace GB: Before " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)
fso.copyfolder ibmsWinsSessionsFolderPath, folder.path & "\WINS", True
log_file_handle.writeline now & " Output Drive Freespace GB: After " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)
log_file_handle.writeline vbnewline

'BACKUP REGISTRY KEYS *****************************************************************************      
log_file_handle.writeline now & " Exporting registry settings..."
shell.run "regedit /e " & folder.path & "\printers.reg HKEY_CURRENT_USER\Printers\Connections\",0,True
shell.run "regedit /e " & folder.path & "\network.reg HKEY_CURRENT_USER\Network\",0,True
shell.run "regedit /e " & folder.path & "\policies.reg "  & chr(34) & "HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Control Panel\Desktop\" & chr(34),0,True
shell.run "regedit /e " & folder.path & "\user_odbc.reg HKEY_CURRENT_USER\Software\ODBC\",0,True
shell.run "regedit /e " & folder.path & "\machine_odbc.reg HKEY_LOCAL_MACHINE\Software\ODBC\",0,True
shell.run "regedit /e " & folder.path & "\internet.reg " & chr(34) & "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\" & chr(34),0,True
shell.run "regedit /e " & folder.path & "\qfiniti.reg " & chr(34) & "HKEY_LOCAL_MACHINE\Software\etalk Corporation\Qfiniti\" & chr(34),0,True
log_file_handle.writeline now & " Registry settings exported..."
log_file_handle.writeline "Backup completed at: " & Now
log_file_handle.writeline vbnewline
og_file_handle.writeline now & " Output Drive Freespace Remaining: " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

MsgBox "Your files have been backed up successfully.  Please click 'Close' on the application to end."
End Function

Function executePermissions()
strHomeFolder = strBackupFolder
strUser = strUsername
Set objShell = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(strHomeFolder) Then
' Assign user permission to home folder.
intRunError = objShell.Run("%COMSPEC% /c Echo Y| cacls " _
& strHomeFolder & " /t /c /g Administrators:F "& strUser & ":F", 2, True)
   If intRunError <> 0 Then
   Wscript.Echo "Error assigning permissions for user " _
   & strUser & " to home folder " & strHomeFolder
   End If
End If
WScript.Quit
End Function

'2. If 1 is selected, then the Restore function will be run.

Function executeRestore()
'Get folder
      on error resume next
Set folder = fso.getfolder(strBackupFolder)
 if folder is nothing Then
             MsgBox = "Could not find backup folder"
            wscript.quit
 Else
     'folder found
 end if
MsgBox "Please close all applications and windows before continuing with the process."

'RESTORE FOLDERS *************************************************************************************
' - Favorites

fso.copyfolder strBackupFolder & "\Favorites", favoritesFolderPath, True

' - My Documents
 fso.copyfolder strBackupFolder & "\My Documents", myDocumentsFolderPath, True

' - Desktop
 fso.copyfolder strBackupFolder & "\Desktop", desktopFolderPath, True

' - Lotus Notes 6
fso.copyfolder strBackupFolder & "\Notes6Data", lotusNotesFolderPath, True
fso.CopyFile strBackupFolder & "\Notes6INI\Notes.ini", lotusNotesINIPath

' - Passport
'fso.copyfolder strBackupFolder & "\Passport", passportFolderPath,  True
fso.CopyFile strBackupFolder & "\Passport\*.zkp", passportFolderPath
fso.CopyFile strBackupFolder & "\Passport\*.zmc", passportFolderPath
fso.CopyFile strBackupFolder & "\Passport\*.kpd", passportFolderPath
fso.CopyFile strBackupFolder & "\Passport\*.kbd", passportFolderPath
fso.CopyFile strBackupFolder & "\Passport\*.mac", passportFolderPath
fso.CopyFile strBackupFolder & "\Passport\*.hot", passportFolderPath
fso.CopyFile strBackupFolder & "\Passport\*.ztb", passportFolderPath
fso.CopyFile strBackupFolder & "\Passport\*.zft", passportFolderPath
fso.CopyFile strBackupFolder & "\Passport\*.zkb", passportFolderPath
fso.CopyFile strBackupFolder & "\Passport\*.lng", passportFolderPath
fso.CopyFile strBackupFolder & "\Passport\*.TAB", passportFolderPath

' - Softphone
fso.CopyFile strBackupFolder &  "\Softphone\MCR-273 Softphone - Policy2.ebm" , softphoneProfileFolderPath
fso.CopyFile strBackupFolder &  "\Softphone\PassportScreenPopFX52.exe" ,  softphoneProfileFolderPath
fso.CopyFile strBackupFolder &  "\Softphone\softphone.ini" ,  softphoneProfileFolderPath
fso.CopyFile strBackupFolder &  "\Softphone\SoftPolicy.txt" , softphoneProfileFolderPath
fso.CopyFile strBackupFolder &  "\Softphone\UnifiedSoftPhone.log" ,  softphoneProfileFolderPath

' - Lotus Notes 8
fso.copyfolder strBackupFolder & "\Notes8ProfileData",  lotusNotes8FolderPath, True
fso.copyfolder strBackupFolder & "\Notes8AllUsersData", lotusNotes8INIFolderPath, True
fso.copyfolder strBackupFolder & "\Notes8NotesDataBackup", lotuNotes8NotesDataBackup, True

' - Sametime
fso.copyfolder strBackupFolder & "\SametimeTranscipts", sametimePathFolder, True
fso.copyfolder strBackupFolder & "\SametimeSavedChats", sametimeChatPathFolder, True

' - CC Pulse
fso.copyfolder strBackupFolder & "\CCPulse", ccpulseFolerPath, True
fso.CopyFile strBackupFolder & "\icewin.ini", ccpulseSupINIPath

' - MS Office
fso.CopyFile strBackupFolder & "\MSOffice\custom.dic", msofficePath

' - AWD
fso.copyfolder strBackupFolder & "\AWD", awdwinfilesPathFolder, True
fso.CopyFile strBackupFolder & "\AWDView\vm.cfg", awdviewPathFolder
fso.CopyFile strBackupFolder & "\AIS\AWDCommon.ini", awdaisPath1Folder
fso.CopyFile strBackupFolder & "\AIS\VBExitPPort.ini", awdaisPath2Folder

' AWD BI
fso.CopyFile strBackupFolder & "\bi.mdb" , awdbidbPathFolder
fso.CopyFile strBackupFolder & "\cust*.rpt" , awdbidbPathFolder

' Voyager
fso.CopyFile strBackupFolder & "\Voyager\cbrt.ini" , voyagerPathFolder
fso.CopyFile strBackupFolder & "\Voyager\windart.ini" , voyagerPathFolder

' - Lotus Notes 6 CLASS
fso.copyfolder strBackupFolder & "\Notes6DataClass", lotusNotesFolderPath, True
fso.CopyFile strBackupFolder & "\NotesClass6INI\Notes.ini", lotusNotesINIClassPath

' - Clarity Workbench
fso.copyfolder strBackupFolder & "\Clarity", ClarityViewsPathFolder, True

' - Xactimate
fso.copyfolder strBackupFolder & "\XactimateDB" , xactimateDBPathFolder, True
fso.copyfolder strBackupFolder & "\XactimateData", xactimateDataPathFolder, True

' Attachmate 3270 Sessions
fso.CopyFile strBackupFolder & "\*.ws" , attachmateClassPath
fso.copyfolder strBackupFolder & "\3270Sessions", attachmateNSCPathFolder, True

' Mitchell AIM
fso.copyfolder strBackupFolder & "\MitchellAIM" , mitchellAIMPath, True

' Class
fso.copyfolder strBackupFolder & "\Class" , classFolderPath, True
fso.CopyFile strBackupFolder & "\ClassIBM\" , classIbmFolderPath
fso.copyfolder strBackupFolder & "\ClassImages" , classImageFolderPath, True
fso.copyfolder strBackupFolder & "\ClassWinRapp" , classWinRappFolderPath, True
fso.CoypFile strBackupFolder & "\WinRapp\" , ccpulseSupINIPath

' Mitchell Suite
fso.copyfolder strBackupFolder & "\MitchellRoot" , classFolderPath, True
fso.copyfolder strBackupFolder & "\MitchellPrograms" , classFolderPath, True
'fso.CopyFile strBackupFolder & "\MitchellUseraux\", mitchellUserauxPathFolder
'fso.CopyFile strBackupFolder & "\MitchellSecusvr\", mitchellSecusvrPathFolder
'fso.CopyFile strBackupFolder & "\MitchellLongexp\", mitchellAcesExpPathFolder
'fso.CopyFile strBackupFolder & "\MitchellSvrdb\", mitchellSecusvrPathFolder
'fso.CopyFile strBackupFolder & "\MitchellLexicon\", mitchellAcesLexPathFolder
'fso.CopyFile strBackupFolder & "\MitchellSyscon\", mitchellSysconPathFolder
'fso.CopyFile strBackupFolder & "\MitchellEclaim\", mitchellProgramsEclaimPathFolder
'fso.CopyFile strBackupFolder & "\MitchellTruckEst\", mitchellProgramsTruckEstPathFolder

' - CCC Pathways
'(Work in Progress)
' 1. c:\Programs\Pathways\config - copyfolder
' 2. c:\programes\Pathways\Data - copyfolder
' 3. c:\programs\Pathways\Datamgr - copyfolder
' 4. c:\programs\pathways\updsav\* - subfolder, copyfile
' 5. c:\programs\pathways\wfmgr\ - subfolder, copyfile
' 6. c:\winxp\Pathways\PCE\*  - subfolder, copyfile
' 7. c:\programs\pathways\local\pwyloc32.ib - subfolder, copyfile

'-  IBM I-Series WINS Sessions
fso.copyfolder strBackupFolder & "\WINS" , ibmsWinsSessionsFolderPath, True

'RESTORE REGISTRY KEYS *****************************************************************************      
shell.run "regedit /s " & folder.path & "\printers.reg",0,True
shell.run "regedit /s " & folder.path & "\network.reg",0,True
shell.run "regedit /s " & folder.path & "\policies.reg",0,True
shell.run "regedit /s " & folder.path & "\user_odbc.reg",0,True
shell.run "regedit /s " & folder.path & "\machine_odbc.reg",0,True
shell.run "regedit /s " & folder.path & "\internet.reg",0,True
shell.run "regedit /s " & folder.path & "\qfiniti.reg",0,True

MsgBox "Your files have been restored successfully. Please wait while your backup file is being deleted."
End Function


' 3.  If 1 is selected and the Restore routine if run, then the delete routine will run after it completes.

Function deleteBackup()
            On Error Resume Next
      fso.deletefolder strBackupFolder,True
            if err.number <> 0 then
            'Try one more time
            set fldr = fso.getfolder(strBackupFolder)
            if not fldr is nothing then
                  fldr.delete true
                  if err.number <> 0 then msgbox "Backup Folder has been deleted."
            else
                  msgbox "The folder " & strBackupFolder & " could not be found.  Check that the path is correct and that you have permissions to delete."
            end if
      else
            msgbox "Your backup file has been deleted. Restore successfull"
      end if
End Function


'LG END SCRIPT ********************************************************
                                                                   
0
 

Author Comment

by:aceklub97
ID: 24138046



' - CCC Pathways 

log_file_handle.writeline now & " Backing up CCC Pathways..."

log_file_handle.writeline now & " Output Drive Freespace GB: Before " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

fso.copyfolder cccpathwaysFolderPath , folder.path & strBackupFolder & "\Pathways", True

'fso.copyfolder cccpathwaysDataFolderPath, folder.path & strBackupFolder & "\PathwaysData", True

'fso.copyfolder cccpathwaysDatamgrFolderPath, folder.path & strBackupFolder & "\PathwaysDataMgr", True

'fso.copyfolder cccpathwaysUpdsavFolderPath, folder.path & strBackupFolder & "\PathwaysUpdsav", True

'fso.CopyFile "c:\PROGRAMS\PATHWAYS\WFMGR\CONFIG.IB", strBackupFolder & "\PathwaysWFMGR\"

'fso.CopyFile "c:\PROGRAMS\PATHWAYS\WFMGR\CONFIGX.IB", strBackupFolder & "\PathwaysWFMGR\"

'fso.CopyFile "c:\PROGRAMS\PATHWAYS\WFMGR\CONFIGMGR.IB", strBackupFolder & "\PathwaysWFMGR\"

'fso.CopyFile "c:\PROGRAMS\PATHWAYS\WFMGR\INSTLUPD.IB", strBackupFolder & "\PathwaysWFMGR\"

'fso.CopyFile "c:\PROGRAMS\PATHWAYS\WFMGR\MGRSWMOD.IB", strBackupFolder & "\PathwaysWFMGR\"

'fso.CopyFile "c:\PROGRAMS\PATHWAYS\WFMGR\PATHWAYS.INI", strBackupFolder & "\PathwaysWFMGR\"

'fso.copyfolder cccpathwaysPCE, folder.path & strBackupFolder & "\PathwaysPCE", True

'fso.CopyFile "c:\PROGRAMS\PATHWAYS\LOCAL\PWYLOC32.IB", strBackupFolder 

log_file_handle.writeline now & " Output Drive Freespace GB: After " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

log_file_handle.writeline vbnewline
 

'-  IBM I-Series WINS Sessions

log_file_handle.writeline now & " Backing up WINS..."

log_file_handle.writeline now & " Output Drive Freespace GB: Before " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

fso.copyfolder ibmsWinsSessionsFolderPath, folder.path & "\WINS", True

log_file_handle.writeline now & " Output Drive Freespace GB: After " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)

log_file_handle.writeline vbnewline
 

'BACKUP REGISTRY KEYS *****************************************************************************      

log_file_handle.writeline now & " Exporting registry settings..." 

shell.run "regedit /e " & folder.path & "\printers.reg HKEY_CURRENT_USER\Printers\Connections\",0,True

shell.run "regedit /e " & folder.path & "\network.reg HKEY_CURRENT_USER\Network\",0,True

shell.run "regedit /e " & folder.path & "\policies.reg "  & chr(34) & "HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Control Panel\Desktop\" & chr(34),0,True

shell.run "regedit /e " & folder.path & "\user_odbc.reg HKEY_CURRENT_USER\Software\ODBC\",0,True

shell.run "regedit /e " & folder.path & "\machine_odbc.reg HKEY_LOCAL_MACHINE\Software\ODBC\",0,True

shell.run "regedit /e " & folder.path & "\internet.reg " & chr(34) & "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\" & chr(34),0,True

shell.run "regedit /e " & folder.path & "\qfiniti.reg " & chr(34) & "HKEY_LOCAL_MACHINE\Software\etalk Corporation\Qfiniti\" & chr(34),0,True

log_file_handle.writeline now & " Registry settings exported..."

log_file_handle.writeline "Backup completed at: " & Now

log_file_handle.writeline vbnewline

og_file_handle.writeline now & " Output Drive Freespace Remaining: " & FormatNumber(fso.getdrive(fso.getdrivename(ROOT_STORAGE_PATH)).freespace / CONVERSION_FACTOR / CONVERSION_FACTOR/ CONVERSION_FACTOR, 1)
 

MsgBox "Your files have been backed up successfully.  Please click 'Close' on the application to end."

End Function
 

Function executePermissions()

strHomeFolder = strBackupFolder

strUser = strUsername

Set objShell = CreateObject("Wscript.Shell")

Set objFSO = CreateObject("Scripting.FileSystemObject")

If objFSO.FolderExists(strHomeFolder) Then

' Assign user permission to home folder.

intRunError = objShell.Run("%COMSPEC% /c Echo Y| cacls " _

& strHomeFolder & " /t /c /g Administrators:F "& strUser & ":F", 2, True)

   If intRunError <> 0 Then

   Wscript.Echo "Error assigning permissions for user " _

   & strUser & " to home folder " & strHomeFolder

   End If

End If

WScript.Quit

End Function
 

'2. If 1 is selected, then the Restore function will be run.
 

Function executeRestore()

'Get folder

	on error resume next

Set folder = fso.getfolder(strBackupFolder)

 if folder is nothing Then

 		MsgBox = "Could not find backup folder"

		wscript.quit

 Else

     'folder found

 end if

MsgBox "Please close all applications and windows before continuing with the process."
 

'RESTORE FOLDERS *************************************************************************************

' - Favorites
 

fso.copyfolder strBackupFolder & "\Favorites", favoritesFolderPath, True
 

' - My Documents

 fso.copyfolder strBackupFolder & "\My Documents", myDocumentsFolderPath, True
 

' - Desktop 

 fso.copyfolder strBackupFolder & "\Desktop", desktopFolderPath, True
 

' - Lotus Notes 6

fso.copyfolder strBackupFolder & "\Notes6Data", lotusNotesFolderPath, True

fso.CopyFile strBackupFolder & "\Notes6INI\Notes.ini", lotusNotesINIPath
 

' - Passport

'fso.copyfolder strBackupFolder & "\Passport", passportFolderPath,  True

fso.CopyFile strBackupFolder & "\Passport\*.zkp", passportFolderPath

fso.CopyFile strBackupFolder & "\Passport\*.zmc", passportFolderPath

fso.CopyFile strBackupFolder & "\Passport\*.kpd", passportFolderPath

fso.CopyFile strBackupFolder & "\Passport\*.kbd", passportFolderPath

fso.CopyFile strBackupFolder & "\Passport\*.mac", passportFolderPath

fso.CopyFile strBackupFolder & "\Passport\*.hot", passportFolderPath 

fso.CopyFile strBackupFolder & "\Passport\*.ztb", passportFolderPath

fso.CopyFile strBackupFolder & "\Passport\*.zft", passportFolderPath

fso.CopyFile strBackupFolder & "\Passport\*.zkb", passportFolderPath

fso.CopyFile strBackupFolder & "\Passport\*.lng", passportFolderPath

fso.CopyFile strBackupFolder & "\Passport\*.TAB", passportFolderPath
 

' - Softphone

fso.CopyFile strBackupFolder &  "\Softphone\MCR-273 Softphone - Policy2.ebm" , softphoneProfileFolderPath

fso.CopyFile strBackupFolder &  "\Softphone\PassportScreenPopFX52.exe" ,  softphoneProfileFolderPath

fso.CopyFile strBackupFolder &  "\Softphone\softphone.ini" ,  softphoneProfileFolderPath

fso.CopyFile strBackupFolder &  "\Softphone\SoftPolicy.txt" , softphoneProfileFolderPath

fso.CopyFile strBackupFolder &  "\Softphone\UnifiedSoftPhone.log" ,  softphoneProfileFolderPath
 

' - Lotus Notes 8 

fso.copyfolder strBackupFolder & "\Notes8ProfileData",  lotusNotes8FolderPath, True

fso.copyfolder strBackupFolder & "\Notes8AllUsersData", lotusNotes8INIFolderPath, True

fso.copyfolder strBackupFolder & "\Notes8NotesDataBackup", lotuNotes8NotesDataBackup, True
 

' - Sametime

fso.copyfolder strBackupFolder & "\SametimeTranscipts", sametimePathFolder, True

fso.copyfolder strBackupFolder & "\SametimeSavedChats", sametimeChatPathFolder, True
 

' - CC Pulse

fso.copyfolder strBackupFolder & "\CCPulse", ccpulseFolerPath, True 

fso.CopyFile strBackupFolder & "\icewin.ini", ccpulseSupINIPath
 

' - MS Office

fso.CopyFile strBackupFolder & "\MSOffice\custom.dic", msofficePath
 

' - AWD

fso.copyfolder strBackupFolder & "\AWD", awdwinfilesPathFolder, True

fso.CopyFile strBackupFolder & "\AWDView\vm.cfg", awdviewPathFolder

fso.CopyFile strBackupFolder & "\AIS\AWDCommon.ini", awdaisPath1Folder

fso.CopyFile strBackupFolder & "\AIS\VBExitPPort.ini", awdaisPath2Folder
 

' AWD BI

fso.CopyFile strBackupFolder & "\bi.mdb" , awdbidbPathFolder

fso.CopyFile strBackupFolder & "\cust*.rpt" , awdbidbPathFolder
 

' Voyager

fso.CopyFile strBackupFolder & "\Voyager\cbrt.ini" , voyagerPathFolder

fso.CopyFile strBackupFolder & "\Voyager\windart.ini" , voyagerPathFolder
 

' - Lotus Notes 6 CLASS

fso.copyfolder strBackupFolder & "\Notes6DataClass", lotusNotesFolderPath, True

fso.CopyFile strBackupFolder & "\NotesClass6INI\Notes.ini", lotusNotesINIClassPath
 

' - Clarity Workbench

fso.copyfolder strBackupFolder & "\Clarity", ClarityViewsPathFolder, True
 

' - Xactimate

fso.copyfolder strBackupFolder & "\XactimateDB" , xactimateDBPathFolder, True

fso.copyfolder strBackupFolder & "\XactimateData", xactimateDataPathFolder, True
 

' Attachmate 3270 Sessions

fso.CopyFile strBackupFolder & "\*.ws" , attachmateClassPath

fso.copyfolder strBackupFolder & "\3270Sessions", attachmateNSCPathFolder, True
 

' Mitchell AIM

fso.copyfolder strBackupFolder & "\MitchellAIM" , mitchellAIMPath, True
 

' Class

fso.copyfolder strBackupFolder & "\Class" , classFolderPath, True

fso.CopyFile strBackupFolder & "\ClassIBM\" , classIbmFolderPath

fso.copyfolder strBackupFolder & "\ClassImages" , classImageFolderPath, True

fso.copyfolder strBackupFolder & "\ClassWinRapp" , classWinRappFolderPath, True

fso.CoypFile strBackupFolder & "\WinRapp\" , ccpulseSupINIPath
 

' Mitchell Suite

fso.copyfolder strBackupFolder & "\MitchellRoot" , classFolderPath, True

fso.copyfolder strBackupFolder & "\MitchellPrograms" , classFolderPath, True

'fso.CopyFile strBackupFolder & "\MitchellUseraux\", mitchellUserauxPathFolder

'fso.CopyFile strBackupFolder & "\MitchellSecusvr\", mitchellSecusvrPathFolder

'fso.CopyFile strBackupFolder & "\MitchellLongexp\", mitchellAcesExpPathFolder

'fso.CopyFile strBackupFolder & "\MitchellSvrdb\", mitchellSecusvrPathFolder

'fso.CopyFile strBackupFolder & "\MitchellLexicon\", mitchellAcesLexPathFolder 

'fso.CopyFile strBackupFolder & "\MitchellSyscon\", mitchellSysconPathFolder

'fso.CopyFile strBackupFolder & "\MitchellEclaim\", mitchellProgramsEclaimPathFolder

'fso.CopyFile strBackupFolder & "\MitchellTruckEst\", mitchellProgramsTruckEstPathFolder
 

' - CCC Pathways 

'(Work in Progress)

' 1. c:\Programs\Pathways\config - copyfolder

' 2. c:\programes\Pathways\Data - copyfolder

' 3. c:\programs\Pathways\Datamgr - copyfolder

' 4. c:\programs\pathways\updsav\* - subfolder, copyfile

' 5. c:\programs\pathways\wfmgr\ - subfolder, copyfile

' 6. c:\winxp\Pathways\PCE\*  - subfolder, copyfile

' 7. c:\programs\pathways\local\pwyloc32.ib - subfolder, copyfile
 

'-  IBM I-Series WINS Sessions

fso.copyfolder strBackupFolder & "\WINS" , ibmsWinsSessionsFolderPath, True
 

'RESTORE REGISTRY KEYS *****************************************************************************      

shell.run "regedit /s " & folder.path & "\printers.reg",0,True

shell.run "regedit /s " & folder.path & "\network.reg",0,True

shell.run "regedit /s " & folder.path & "\policies.reg",0,True

shell.run "regedit /s " & folder.path & "\user_odbc.reg",0,True

shell.run "regedit /s " & folder.path & "\machine_odbc.reg",0,True

shell.run "regedit /s " & folder.path & "\internet.reg",0,True

shell.run "regedit /s " & folder.path & "\qfiniti.reg",0,True
 

MsgBox "Your files have been restored successfully. Please wait while your backup file is being deleted."

End Function
 
 

' 3.  If 1 is selected and the Restore routine if run, then the delete routine will run after it completes.
 

Function deleteBackup()

		On Error Resume Next

	fso.deletefolder strBackupFolder,True

		if err.number <> 0 then

		'Try one more time

		set fldr = fso.getfolder(strBackupFolder)

		if not fldr is nothing then

			fldr.delete true

			if err.number <> 0 then msgbox "Backup Folder has been deleted."

		else

			msgbox "The folder " & strBackupFolder & " could not be found.  Check that the path is correct and that you have permissions to delete."

		end if

	else

		msgbox "Your backup file has been deleted. Restore successfull"

	end if

End Function
 
 

'LG END SCRIPT ********************************************************

                                                                    

Open in new window

0
 
LVL 22

Accepted Solution

by:
danaseaman earned 500 total points
ID: 24138362
As is your code uses
strParentFolder = "\\deptsvr\training\"

and subfolders returned by FSO are:
"\\deptsvr\training\_Sales\"
"\\deptsvr\training\_Processing\"
"\\deptsvr\training\_Service\"

If this is incorrect, and subfolders are:
"\\deptsvr\training_Sales\"
"\\deptsvr\training_Processing\"
"\\deptsvr\training_Service\"

Then you need to use strParentFolder = "\\deptsvr\ to get the subfolder names
0
 

Author Closing Comment

by:aceklub97
ID: 31569380
Thanks for the help that is where I was going wrong.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now