This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Files cannot be copied from network drive in BasicMSI
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 10, 2012
06:59 AM
Files cannot be copied from network drive in BasicMSI
Hello,
My installation package should copy configuration files from some specific location to another. In my basic MSI I call XCopyFile function which works pretty good if installer and configuration files are located on the local hard drive. But files are not copied if installer and configuration files are located on the mapped network drive. The piece of script is presented below
#define CONFIG_DIR "Config"
nBuffer = MAX_PATH;
if (MsiGetProperty(hMSI, "CustomActionData", szLine, nBuffer) == ERROR_SUCCESS) then;
listID = ListCreate(STRINGLIST);
if (StrGetTokens (listID, szLine, ";") > 0) then;
// Report the error.
MessageBox ("StrGetTokens failed.", SEVERE);
else
nResult = ListGetFirstString (listID, RootFolder);
nResult = ListGetNextString (listID, InstallDir);
nResult = ListGetNextString (listID, SourceDir);
endif;
ListDestroy (listID);
endif;
nResult = XCopyFile(SourceDir ^ CONFIG_DIR ^ "*.*", InstallDir ^ CONFIG_DIR ^ "*.*", COMP_NORMAL);
RootFolder, InstallDir, SourceDir values are taken correctly. I checked that by calling MessageBox. My major suspect that copying failed because installer runs under system account, which cannot access domain network drive.
Could you please advise me how it can be fixed?
Thank you in advance.
Cheers, Georgiy
My installation package should copy configuration files from some specific location to another. In my basic MSI I call XCopyFile function which works pretty good if installer and configuration files are located on the local hard drive. But files are not copied if installer and configuration files are located on the mapped network drive. The piece of script is presented below
#define CONFIG_DIR "Config"
nBuffer = MAX_PATH;
if (MsiGetProperty(hMSI, "CustomActionData", szLine, nBuffer) == ERROR_SUCCESS) then;
listID = ListCreate(STRINGLIST);
if (StrGetTokens (listID, szLine, ";") > 0) then;
// Report the error.
MessageBox ("StrGetTokens failed.", SEVERE);
else
nResult = ListGetFirstString (listID, RootFolder);
nResult = ListGetNextString (listID, InstallDir);
nResult = ListGetNextString (listID, SourceDir);
endif;
ListDestroy (listID);
endif;
nResult = XCopyFile(SourceDir ^ CONFIG_DIR ^ "*.*", InstallDir ^ CONFIG_DIR ^ "*.*", COMP_NORMAL);
RootFolder, InstallDir, SourceDir values are taken correctly. I checked that by calling MessageBox. My major suspect that copying failed because installer runs under system account, which cannot access domain network drive.
Could you please advise me how it can be fixed?
Thank you in advance.
Cheers, Georgiy
(4) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 10, 2012
07:44 AM
You are right: the system account does not know about your mapped network drive.
You could try the following solutions:
[LIST=1]
Use the full UNC path instead of the mapped network drive path. I don't know if that works with XCopyFile, but it might be worth a try.
Launch a command prompt as administrator, and use the "net" command to map your network drive. Then launch your setup from the command prompt.
If the 2nd approach works, the you could try to call this "net" command in a custom action.
A part from that, I would avoid copying files with XCopyFile in a custom action, because it means your setup will copy files that are not in your "File" table.
It sounds like something which goes against best practices, in my opinion.
What do you think?
You could try the following solutions:
[LIST=1]
If the 2nd approach works, the you could try to call this "net" command in a custom action.
A part from that, I would avoid copying files with XCopyFile in a custom action, because it means your setup will copy files that are not in your "File" table.
It sounds like something which goes against best practices, in my opinion.
- You need to take care of deleting the file(s) when deinstalling or upgrading.
- You need to implement a rollback action.
- The file(s) you copy won't be taken into account in the disk space cost.
- How can you associate the file(s) with a component or with a feature?
What do you think?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 10, 2012
08:04 AM
Thank you for advises but unfortunately none of them worked, and files from Config directory have not been copied to destination directory.
Probably my approach is not the best, but I don't any better idea how to copy extra configuration files which are specific for every single installation.
Could you please tell whether you have any idea how I can manage to copy extra files if they exist?
Regards, Georgiy
Probably my approach is not the best, but I don't any better idea how to copy extra configuration files which are specific for every single installation.
Could you please tell whether you have any idea how I can manage to copy extra files if they exist?
Regards, Georgiy
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 11, 2012
12:13 AM
Well, are these files totally different? Or are they all very similar for each target machine?
Could you pack them all in the installation package, identify which target machine it is, and install one or the other lot of configuration files? You could use component conditions for that.
Alternatively, If these config files only differ by a few lines, you might be able to install one "generic" config file, and use either the "INI File Changes", the "XML File Changes" or the "Text File Changes" to configure it for the target PC.
Another alternative would consist of considering this configuration step separately from the installation.
How does that sound?
Could you pack them all in the installation package, identify which target machine it is, and install one or the other lot of configuration files? You could use component conditions for that.
Alternatively, If these config files only differ by a few lines, you might be able to install one "generic" config file, and use either the "INI File Changes", the "XML File Changes" or the "Text File Changes" to configure it for the target PC.
Another alternative would consist of considering this configuration step separately from the installation.
- Your installation package would only install the application, without these configuration files.
- Then on first use, your application would not find these configuration files, and copy them from your network drive.
- You might have to move these configuration files to the "CommonAppData" or "AppData" folder of your target PC, instead of copying them in the application folder, unless your application is running as Administrator every time.
How does that sound?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 14, 2012
12:49 AM
Yes, files might differ per installation hence they we probably provide different installation packages.
Here we decided to resolve this problem just by calling .bat file which will copy all necessary file if needed.
Thank you for your help and advices.
Cheers, Georgiy
Here we decided to resolve this problem just by calling .bat file which will copy all necessary file if needed.
Thank you for your help and advices.
Cheers, Georgiy