I am under the context of a script executed within an installation package MSI created with InstallShield. I execute the below script:
Set wshShell = CreateObject( "WScript.Shell" )
User = wshShell.ExpandEnvironmentStrings( "%USERNAME%" )
MsgBox "User: " & User
' The parameters are received through MSI parameters
' msiexec /I MyMSI_x64.msi configFileSrc="Z:\MyFolder\FileToCopy.txt" configFolderDst="c:\temp\"
' Testing parameters
Dim configFileSrc, configFolderDst
configFileSrc = "Z:\MyFolder\FileToCopy.txt"
configFolderDst = "c:\temp\"
' **********************************************************************
' Copy file to destination folder
' **********************************************************************
if(configFileSrc <> "") Then
call copyFile(configFileSrc, configFolderDst)
End if
' **********************************************************************
' Function to copy file
' **********************************************************************
Sub CopyFile(SourceFile, DestinationFile)
Set fso = CreateObject("Scripting.FileSystemObject")
If not fso.FileExists(SourceFile) Then
MsgBox "The file " & SourceFile & " is not found and will therefore not be copied to destination folder.", vbExclamation, "Parameter file not found"
Exit Sub
End If
...
The FileExists always return false when executed from a mounted drive. When the script is executed locally (replacing configFileSrc which is actually provided as a parameter), the the script works fine. I am pretty sure that InstallShield use the Admin local account of the machine which have potentially no permission on the mounted drive but I don't know how to check. I have tried to display the current user strUserName but the box is empty. Any idea?