/build/static/layout/Breadcrumb_cap_w.png

Script to copy a file within a CA

Hi all!

I´m about to distribute Java1.6update26 and we want to disable the use of javacache on the clients. I found that this setting is stored in a user-specific file under %APPDATA%. If I include this file in a .mst file with the distribution of the java msi-package the file just gets overwritten again, strangely.
So I thought of writing a vb-script to include in the .mst file as a custom action. I get the script to work standalone. But when I include it in the package as a CA it doesnt work. here is the script:

Set oShell = CreateObject("WScript.Shell")
Set oProcEnv = oShell.Environment("PROCESS")

sAppData = oProcEnv("APPDATA")

Const OverwriteExisting = True
Set objFSO = CreateObject("Scripting.FileSystemObject")

Dim strScriptFolder: strScriptFolder = strReverse(Split(strReverse(WScript.ScriptFullName),"\",2)(1))

testPath = sAppData & "\Sun"
testPath2 = sAppData & "\Sun\Java"
testPath3 = sAppData & "\Sun\Java\Deployment"


If Not objFSo.FolderExists (sAppData & "\Sun") Then
objFSO.CreateFolder (testPath)
End If

If Not objFSo.FolderExists (sAppData & "\Sun\Java") Then
objFSO.CreateFolder (testPath2)
End If

If Not objFSo.FolderExists (sAppData & "\Sun\Java\Deployment") Then
objFSO.CreateFolder (testPath3)
End If


objFSO.CopyFile (strScriptFolder & "\Turn off cache WinXP\deployment.properties") , (sAppData & "\Sun\Java\Deployment\"), OverwriteExisting



If I turn on verbose logging i see this in the log:


MSI (s) (A4:EC) [15:22:54:719]: Executing op: CustomActionSchedule(Action=CopyDeploymentFile,ActionType=3174,Source=Set oShell = CreateObject("WScript.Shell")
Set oProcEnv = oShell.Environment("PROCESS")

sAppData = oProcEnv("APPDATA")

Const OverwriteExisting = True
Set objFSO = CreateObject("Scripting.FileSystemObject")

Dim strScriptFolder: strScriptFolder = strReverse(Split(strReverse(WScript.ScriptFullName),"\",2)(1))

testPath = sAppData & "\Sun"
testPath2 = sAppData & "\Sun\Java"
testPath3 = sAppData & "\Sun\Java\Deployment"


If Not objFSo.FolderExists (sAppData & "\Sun") Then
objFSO.CreateFolder (testPath)
End If

If Not objFSo.FolderExists (sAppData & "\Sun\Java") Then
objFSO.CreateFolder (testPath2)
End If

If Not objFSo.FolderExists (sAppData & "\Sun\Java\Deployment") Then
objFSO.CreateFolder (testPath3)
End If


objFSO.CopyFile (strScriptFolder & "\Turn off cache WinXP\deployment.properties") , (sAppData & "\Sun\Java\Deployment\"), OverwriteExisting,,)
MSI (s) (A4:D0) [15:22:54:735]: Entering MsiProvideComponentFromDescriptor. Descriptor: HPD6MtrDa8[E~8.eoGBFDomestic>M5KDYSUnf(HA*L[xeX)y, PathBuf: CAF340, pcchPathBuf: CAF33C, pcchArgsOffset: CAF294
MSI (s) (A4:D0) [15:22:54:735]: MsiProvideComponentFromDescriptor called for component {997FA962-E067-11D1-9396-00A0C90F27F9}: returning harcoded oleaut32.dll value
MSI (s) (A4:D0) [15:22:54:735]: MsiProvideComponentFromDescriptor is returning: 0
MSI (s) (A4:D0) [15:22:54:751]: Note: 1: 1720 2: CopyDeploymentFile 3: -2146827864 4: Körningsfel i Microsoft VBScript 5: Objekt krävs.: 'WScript' 6: 9 7: 22
MSI (s) (A4:D0) [15:22:54:751]: Transforming table Error.

The error translates into english something like this: "Runtime error in Microsoft VBScript 5: Object is needed.: "Wscript" 6: 9 7:


Can some1 tell me what the problem is, I´d really appreciate it!

0 Comments   [ + ] Show comments

Answers (3)

Posted by: anonymous_9363 12 years ago
Red Belt
0
Can some1 tell me what the problem isYou're going about it the wrong way.

You should be using either self-healing via a feature containing the user-level parts or, at worst, Active Setup. Both are documented to death here at AppDeploy and elsewhere.
Posted by: Agathorn 12 years ago
Senior Purple Belt
0
Thanks a lot VBScab! Your comment got me to further investigate why I was unable to add the file in the ordinary way using the files table. I then saw that I added the file to APPDATA and not AppDataFolder. My bad! So no script is needed!

But since this is java, I dont see how I can avoid using Active Setup since users dont click on a "java-shortcut" or start a .jar file, but simply uses it to view java-rich webpages. Or is it maybe something I´m missing on how to selfheal without Active Setup?
Posted by: aogilmor 12 years ago
9th Degree Black Belt
0
the normal repair or self heal won't work with Java -- notice it's not a true MSI based intstallation but uses Custom actions to explode the java zipped files -- but you could still use ActiveSetup to copy files added to the installation.
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