/build/static/layout/Breadcrumb_cap_w.png

VB Script Deleting 2 folders

Hey Guys,

i made a custom action to delete 2 folders under c:\program file that is laid by the msi. When i delete the package manually my custom action works but when i push it through the SMS it doesn't work. This is how my VB script looks like in the custom action.

Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFolder("C:\Program Files\Test1 2007")
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFolder("C:\Program Files\Test2 2007")

0 Comments   [ + ] Show comments

Answers (6)

Posted by: gmorgan618 16 years ago
Blue Belt
0
Here... Add this function and just call it

fnFolderDelete ("C:\Program Files\Test1 2007")

Function fnFolderDelete(Path)
Dim oFSO
Set oFSO = CreateObject("Scripting.FileSystemObject")
If oFSO.FolderExists(Path) Then
oFSO.DeleteFolder Path,TRUE
End If
Set oFSO = nothing

End Function
Posted by: anonymous_9363 16 years ago
Red Belt
0
If it works 'manually', it should work in deployment.
- Are you logging the install? If so, has the Custom Action run?
- Where is your CA running, i.e. in which sequence?

On a point of order...you don't need to create the objFSO object again:

Dim objFSO
Const strFolder1 = "C:\Program Files\Test1 2007"
Const strFolder2 = "C:\Program Files\Test2 2007"
Set objFSO = CreateObject("Scripting.FileSystemObject")
With objFSO
If .FolderExists(strFolder1) Then
.DeleteFolder(strFolder1)
End If
If .FolderExists(strFolder2) Then
.DeleteFolder(strFolder2)
End If
End With
Set objFSO = Nothing
Posted by: chichora2003 16 years ago
Orange Belt
0
This is how my custom action looks like

Install Exec Seq= After InstallFinalize
Install Exec Con=REMOVEALL
Posted by: chichora2003 16 years ago
Orange Belt
0
Thanks VBSCAB it worked i had to change my condition to REMOVE="ALL" instead of REMOVEALL.

Thanks for the support again
Posted by: matrixtushar 16 years ago
Purple Belt
0
yes i knew it!!

actually if the VBScript was running, it was only the MSI that had the problem! thanks to VBScab! [:)]
this person rocks!

However, it would be better if you included Folder deletion directly in the MSI rather than running the VBScript, unless there is any specific reason!

Merci!
Posted by: chichora2003 16 years ago
Orange Belt
0
The following sections describe how to use record mode on Windows.
Using Record Mode
To record a new response file:
At the command prompt, use the cd command to change to the directory that contains the OUI executable file (setup.exe) for your installation.
Enter the following command:
setup -record -destinationFile <response_file_name> (on Windows)
Replace the <response_file_name> with the complete path for the new response file. For example:
setup -record -destinationFile C:\response_files\install_oracle910 (on Windows)
Use the OUI user interface to select your installation options. These will be recorded.
When OUI displays the Summary page, you can either continue with the installation or exit.
OUI saves your new response file using the path and file name you specified on the command line.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ