/build/static/layout/Breadcrumb_cap_w.png

Custom action vbs doesn't run in InstallShield

Hi guys I'm trying to run the below vbs script inside a custom action on an InstallShield.vbs. The script runs fine if i run it on its own, however when i run it inside the msi i get Error1720

I replaced the last line with the hard coded path for the users %HOMESHARE% but i still get the same issue inside the custom action. I need to run it on install only, hence I'm running it in Deffered System Context with NOT Installed as my Installed Sequence just before Install Finalize

I'm really stumped any help would be great 

Const OverWriteFiles = True
Set oWSH = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oUserProfilePath = oWSH.Environment("Process")

'Setup the environment variables for %homedrive%, %homepath%, and %clientname%
osystemroot = oWSH.ExpandEnvironmentStrings("%Systemroot%")
sUserHDrive = oUserProfilePath("HOMEDRIVE")
sProfile = oWSH.ExpandEnvironmentStrings("%HOMESHARE%")

'Check to see if the folder "Software Directory" exists in the user's %homedrive% directory
'if it does exist then do Nothing
If oFSO.FolderExists(sUserHDrive & "\Software") Then

    WithCreateObject("Shell.Application")
            
    .Open(sUserHDrive & "\Software\Software Templates\PPM\PPM Wizard.dot") EndWith

'If the "Talsico" directory doesn't exist then proceed

Else

'Create the "Talsico" directory

IfNot oFSO.FolderExists(sUserHDrive & "\Software") Then

    Set objFolder = oFSO.CreateFolder(sUserHDrive & "\Software")
EndIf

EndIf

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFolder"C:\Program Files (x86)\App Software" , "O:\Software" , OverWriteFiles

 


0 Comments   [ + ] Show comments

Answers (3)

Answer Summary:
I managed to use my script and amend it slightly to also set the trusted locations on the users profile. I created an advertised icon, that launches the vbscript which does everything.
Posted by: jaybee96 11 years ago
Red Belt
0

if it runs under "SYSTEM" context , would the homeshare be recognized? 
impersonating SYSTEM and trying to do actions in user specific locations is not possible.

Either try to run the script under deferred execution..or immediate after install finalize.

 

Posted by: jagadeish 11 years ago
Red Belt
0

Few suggestions..

1. You don't have to create the below object twice in your code..

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFolder"C:\Program Files (x86)\App Software" , "O:\Software" , OverWriteFiles

2. If oFSO.FolderExists(sUserHDrive & "\Software") Then

    WithCreateObject("Shell.Application")
            
    .Open(sUserHDrive & "\Software\Software Templates\PPM\PPM Wizard.dot") EndWith

'If the "Talsico" directory doesn't exist then proceed

Else // Here Else means the folder doesn't exist

'Create the "Talsico" directory
//Again you are checking whether the specified folder is exist or not in else condition itself//

'Create the "Talsico" directory

IfNot oFSO.FolderExists(sUserHDrive & "\Software") Then

    Set objFolder = oFSO.CreateFolder(sUserHDrive & "\Software")
EndIf

EndIf

 

Posted by: djjass 11 years ago
Senior Purple Belt
0

Thanks all, i managed to use my script and amend it slightly to also set the trusted locations on the users profile.

 

I created an advertised icon, that launches the vbscript which does everything. 

 

 
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