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!
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)
Please log in to answer
Posted by:
anonymous_9363
13 years ago
Posted by:
Agathorn
13 years ago
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?
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
13 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.