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

 

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.
Cancel
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Answers

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.

 

Answered 03/06/2013 by: jaybee96
Red Belt

Please log in to comment
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

 

Answered 03/06/2013 by: jagadeish
Red Belt

Please log in to comment
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. 

 

Answered 03/07/2013 by: djjass
Senior Purple Belt

Please log in to comment
Answer this question or Comment on this question for clarity
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja

Share