Active Setup with VBScript
Hey people,
Apologies if I don't sound as though I'm explaining this very well. I've been packaging apps for 3 months now, using InstallShield. I have a background in Programming but can't for the life of me work out why this particular problem is occuring, although it is probably something stupid or related to my environment.
I am in the middle of packaging a Documentum client, some of you may know what that is but its irrelevant. When the application installs it installs some certificates in the installdir with the application. I have included a VBS within a custom action which copies certain certficates (Java certs btw) to the current user's profile (specifically the \AppData\LocalLow\ folder) depending on what version of Java is installed on the computer. The certificates are only copied if my app is installed, so a restart is required after install.
The application includes Active Setup HKLM registry keys so it runs for every user that logs on. The problem I am having with the script is that it isn't creating the folders that I am asking it to create for any users other than the user that installs the application. When the folders are created, I have forced the script to write to the event log so that I can see that it has evaluated the If statement beforehand.
The script works fine for the user that installs the app. If I take the script from InstallShield and run it as a standard script within Windows logged on as any of the other test standard users it creates the folder structure with no problems.
My question is, what is likely to be causing this? Is it Permissions on log on? If so why does the script work when the user has fully logged on?
Apologies if I don't sound as though I'm explaining this very well. I've been packaging apps for 3 months now, using InstallShield. I have a background in Programming but can't for the life of me work out why this particular problem is occuring, although it is probably something stupid or related to my environment.
I am in the middle of packaging a Documentum client, some of you may know what that is but its irrelevant. When the application installs it installs some certificates in the installdir with the application. I have included a VBS within a custom action which copies certain certficates (Java certs btw) to the current user's profile (specifically the \AppData\LocalLow\ folder) depending on what version of Java is installed on the computer. The certificates are only copied if my app is installed, so a restart is required after install.
The application includes Active Setup HKLM registry keys so it runs for every user that logs on. The problem I am having with the script is that it isn't creating the folders that I am asking it to create for any users other than the user that installs the application. When the folders are created, I have forced the script to write to the event log so that I can see that it has evaluated the If statement beforehand.
The script works fine for the user that installs the app. If I take the script from InstallShield and run it as a standard script within Windows logged on as any of the other test standard users it creates the folder structure with no problems.
My question is, what is likely to be causing this? Is it Permissions on log on? If so why does the script work when the user has fully logged on?
0 Comments
[ + ] Show comments
Answers (7)
Please log in to answer
Posted by:
anonymous_9363
14 years ago
Your script should have suitable error-trapping in, to enable you to see exactly why the folders aren't created. Presumably you have some sort of recursive 'CreateFolder' function? Make sure that it logs its activity, particularly any return value which isn't zero. You can then look up that return value in something like DOSERROR.H. The common ones are 2 (File not found); 3 (Path not found) and 5 (Access denied).
Posted by:
ptierney
14 years ago
The script wasn't written by myself, but I did what you suggested and added in a trap - and an error was reported. The error number is 76, which is Path not Found. I added in some extra lines of code to make sure that my VBS was trying to create the correct folder, and it is - it just doesn't!
The LocalLowFolder is the C:\Users\user\AppData\LocalLow folder in a users' Vista profile. The path is output correctly. My question is, why is an error of Path Not Found being reported, when it knows the path!
If I doing something stupid can somebody please point it out for me, it is Monday after all.
'~ Create folder structure if missing
Set objFSO = CreateObject("Scripting.FileSystemObject")
'~ If folder does not exist
If Not objFSO.FolderExists(strLocalLowFolder & "\Sun") Then
'~ Create it
Set objFolder = objFSO.CreateFolder(strLocalLowFolder & "\Sun")
If Err.Number <> 0 Then
'~ An exception occurred
Set objShell = CreateObject("WScript.Shell")
objShell.LogEvent EVENT_WARNING, strPackageName & " Error Number: " & Err.Number & " Error Description: " & Err.Description & " Path is: " & strLocalLowFolder
Else
Set objShell = CreateObject("WScript.Shell")
objShell.LogEvent EVENT_WARNING, strPackageName & " - Created Folder: " & strLocalLowFolder & "\Sun"
End If
End If
The LocalLowFolder is the C:\Users\user\AppData\LocalLow folder in a users' Vista profile. The path is output correctly. My question is, why is an error of Path Not Found being reported, when it knows the path!
If I doing something stupid can somebody please point it out for me, it is Monday after all.
Posted by:
anonymous_9363
14 years ago
A thought occurs...why use AS? Why not create a user-level feature and move a feature which has an advertised entry-point (e.g. a shortcut) so that it becomes a child of the user-level feature? That way, as soon as the shortcut is clicked, self-healing will kick in and install whatever junk the app requires.
Posted by:
ptierney
14 years ago
I have an advertised shortcut as part of the main feature already. This doesn't work in the way that you are suggesting. I understand what you are saying, although the script installs certificates depending on the version of Java that is installed - this is why I have a copy of all possible required certs installed with the application, and then the script selects them depending on the Java version and moves them to the new folder.
The way that my application is at the moment when I run the application as another user, it doesn't execute this script as part of the repair. Should it, as you are suggesting? Thanks.
The way that my application is at the moment when I run the application as another user, it doesn't execute this script as part of the repair. Should it, as you are suggesting? Thanks.
Posted by:
captain_planet
14 years ago
Why not do as VBScab says, but put some conditions on your components too?
So first of all, read this blog and it will tell you how self healing works: http://johnmcfadyen.spaces.live.com/blog/cns!9DD01136FC094724!123.entry
So you'll create a child feature under your main feature, and in that you'll put your components - each containing a single certificate as a keypath for the different versions.
Then, create a property called JAVAVERSION in the Property table (or similar....give it a default value too), and in your Type 38 Custom Action (which is scheduled as Immediate and before InstallInitialize) it would be something like:
Dim javaver
javaver = /*logic to return java version.....*
Session.Property("JAVAVERSION") = javaver 'sets the property to the java version
And for each component, add a condition. For example:
component name: javaCert1
condition: JAVAVERSION="1.0.0" 'will only install if java version is 1.0.0
component name: javaCert2
condition: JAVAVERSION="2.0.0" 'will only install if java version is 2.0.0
etc etc etc....
So first of all, read this blog and it will tell you how self healing works: http://johnmcfadyen.spaces.live.com/blog/cns!9DD01136FC094724!123.entry
So you'll create a child feature under your main feature, and in that you'll put your components - each containing a single certificate as a keypath for the different versions.
Then, create a property called JAVAVERSION in the Property table (or similar....give it a default value too), and in your Type 38 Custom Action (which is scheduled as Immediate and before InstallInitialize) it would be something like:
Dim javaver
javaver = /*logic to return java version.....*
Session.Property("JAVAVERSION") = javaver 'sets the property to the java version
And for each component, add a condition. For example:
component name: javaCert1
condition: JAVAVERSION="1.0.0" 'will only install if java version is 1.0.0
component name: javaCert2
condition: JAVAVERSION="2.0.0" 'will only install if java version is 2.0.0
etc etc etc....
Posted by:
ptierney
14 years ago
Posted by:
ptierney
14 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.