cancel
Showing results forΒ 
Search instead forΒ 
Did you mean:Β 

How do you use the API to make a File and Folder Restore operation?

Dr_Hao
Not applicable

Symantec System Recovery 2011 has a rich API which is fully documented in the Docs\Automation folder on the source media.

Although the 2011 version has more examples than previously released versions, I fail to make a successful vbscript that automates a File and Folder Restore operation. I have managed, however, to script the File and Folder backup job itself.

When I run the code below, I create a RestoreSelector object and point to the folder which contents I would like to restore (D:\PRIVAT\DATA40).
I also add a search pattern to include alle files (*).
Then I create a FileRestore object and add the created RestoreSelector. I call the Search method on the FileRestore object and actually finds the back upped files, since I get the correct number of files from the returned array - so far so good.

Last I try and call the Restore method on the FileRestore object - and this is where I get an error message:

This is the code I've put together so far:

 

Set v2iAuto = CreateObject("Symantec.ProtectorAuto")
 
Set oNet = CreateObject("Wscript.Network")
Call v2iAuto.Connect(oNet.ComputerName)
 
Set oRestoreSelector = CreateObject("Symantec.FileBackup.RestoreSelector")
 
oRestoreSelector.Folder = "D:\PRIVAT\DATA40"
oRestoreSelector.AddPattern("*")
oRestoreSelector.IncludeSubFolders = True
 
Set oFileRestore = CreateObject("Symantec.FileBackup.FileRestore")
 
oFileRestore.AddSelector(oRestoreSelector)
arrFilesFound = oFileRestore.Search(10000)
 
'--- number of files found
Wscript.Echo UBound(arrFilesFound) + 1
 
oFileRestore.Destination = "D:\PRIVAT\DATA40"
oFileRestore.Overwrite = True
 
oFileRestore.Restore
 
Wscript.Echo "Done"
0 REPLIES 0