File Copy Fails

Got a problem you cannot solve? Try here.
SebSpiers
Posts: 38
Joined: Tue Dec 20, 2016 7:14 am
Location: Tewkesbury, UK

File Copy Fails

Postby SebSpiers » Fri Dec 23, 2016 7:16 am

Hi,

So I have a very simple part of my installer which copies a file from one location to another.

Code: Select all

Run Program C:\Windows\System32\copy.exe C:\Temp\applicationHost.config C:\Windows\System32\inetsrv\config\applicationHost.config /y (WAIT)


When I run this from an elevated command prompt, it works just fine, when it runs as part of the installer, it does nothing, it doesn't even error.

I've tried sending the output to a log file but it isn't generated when run from InstallAware, it is however when I run the same command from CMD.

Any ideas?
I'm not a developer, I just want to install things...

SebSpiers
Posts: 38
Joined: Tue Dec 20, 2016 7:14 am
Location: Tewkesbury, UK

Re: File Copy Fails

Postby SebSpiers » Fri Dec 23, 2016 7:55 am

I tried running this from within a batch file and found that it claims to have been successful, however the file has not been copied.

Installer code:

Code: Select all

Run Program $SUPPORTDIR$\copy_IIS_config.bat  (WAIT)

Batch File Content:

Code: Select all

copy C:\Temp\applicationHost.config C:\Windows\System32\inetsrv\config\applicationHost.config /y
pause

Output:

Code: Select all

D:\Projects\SmartInstantIssuance2\Smart Instant Issuance>copy C:\Temp\applicationHost.config C:\Windows\System32\inetsrv\config\applicationHost.config /y
        1 file(s) copied.

D:\Projects\SmartInstantIssuance2\Smart Instant Issuance>pause
Press any key to continue . . .
I'm not a developer, I just want to install things...

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: File Copy Fails

Postby FrancescoT » Fri Dec 23, 2016 11:19 am

Dear SebSpiers,

there may be several causes at the root of your issue.

A- First of all and if your target is a x64 system, please consider that by default any setup package runs as a native 32bit application. Due of this, any call that points to a system directory or to HKLM system registry, it will be redirected by the system to the respective x86 location.

In other words, trying to store something to; "C:\Windows\System32" this will be stored to "C:\Windows\SysWOW64" instead.

At such purpose you may force the installer to instruct a native x64 process using the "Set x64 - Native 64 bit Windows, ..." statement.

B- also consider that because you are trying to store a file under a system restricted area ("C:\Windows\System32"), the process requires full administrative privileges to be completed successfully.

C- even for "cmd.exe" you should consider the behavior that I described at point #A. If your target is a x64 system, there are two distinct versions of the "cmd.exe" (the cmd-exe embeds the DOS Copy command). The native x64 version is available under "system32" while the respective x86 Platform version is stored under "SysWOW64". Consequently if your setup runs as a native 32bit application, the one effectively used will be the respective x86 "cmd.exe" under "SysWOW64".

That said, you may try the following;

Code: Select all

Set x64 - Native 64 bit Windows, AMD64 and EM64T Architectures - installation mode
 
Set Variable SYS_DIR to
Get Folder Location System->System Directory into SYS_DIR
Run Program "$SYS_DIR$\cmd.exe" /c copy "C:\Temp\applicationHost.config" "$SYS_DIR$\inetsrv\config\applicationHost.config" /y (WAIT)
Set Win32 - Native 32 bit Windows and Windows 32 on Windows 64 (WOW64) - installation mode

the same as above in "InstallAware Clipboard Data";

Code: Select all

~InstallAware Clipboard Data~
~Comment~
~{FA49E179-57A1-4B32-B446-4F578588D9EB}~
~~
~Set 64 Bit Mode~
~{8EE9F2EA-8C47-46DC-88CF-132D134353CF}~
~TRUE~
~FALSE~
~FALSE~
~Run Program~
~{31580F40-CDEA-4098-A876-1008DB8AA64E}~
~"$SYS_DIR$\cmd.exe"~
~TRUE~
~/c copy "C:\Temp\applicationHost.config" "$SYS_DIR$\inetsrv\config\applicationHost.config" /y~
~TRUE~
~~
~Get Folder Location~
~{60723E82-FC27-4FD7-94E9-A95A38413FFA}~
~SYS_DIR~
~23~
~FALSE~
~Set Variable~
~{31424C06-0E45-4C33-829E-93C552F8A5F8}~
~SYS_DIR$MYAH$MYAH$FALSE~
~~
~Comment~
~{F1142BD4-F34F-43F3-9E59-CD4437521131}~
~~
~Set 64 Bit Mode~
~{08C518DB-FFC8-42CE-9E53-617714928A3D}~
~FALSE~
~FALSE~
~TRUE~


Alternatively and in place of the "CMD.EXE", you may use the IA "Copy/Move Local Files" command. Note this is a Windows Installer Command (PURPLE COMMANDS) and in order to execute it immediately, it's necessary to switch ON the InstallAware Native Engine.

Code: Select all

Set x64 - Native 64 bit Windows, AMD64 and EM64T Architectures - installation mode
Set Variable NATIVE_ENGINE to TRUE
 
Set Variable SYS_DIR to
Get Folder Location System->System Directory into SYS_DIR
Copy Local Files "C:\Temp" \applicationHost.config to "$SYS_DIR$\inetsrv\config"\applicationHost.config
Set Variable NATIVE_ENGINE to FALSE
Set Win32 - Native 32 bit Windows and Windows 32 on Windows 64 (WOW64) - installation mode

the same as above in "InstallAware Clipboard Data";

Code: Select all

~InstallAware Clipboard Data~
~Set 64 Bit Mode~
~{8D5C21D0-3396-4D81-BE3E-75EB4627CCB3}~
~TRUE~
~FALSE~
~FALSE~
~Set Variable~
~{D9A2E9F2-7648-4F2E-AD54-3F406C4751FF}~
~NATIVE_ENGINE$MYAH$MYAH$FALSE~
~FALSE~
~Copy/Move Local Files~
~{7DB220A1-D8C3-4749-8ED4-A7CBE1E081EF}~
~"C:\Temp" ~
~applicationHost.config~
~"$SYS_DIR$\inetsrv\config"~
~applicationHost.config~
~TRUE~
~FALSE|FALSE~
~Get Folder Location~
~{0F9A8F89-2AB4-41CB-B97F-2E720D9ACB8A}~
~SYS_DIR~
~23~
~FALSE~
~Set Variable~
~{ED66B34F-E5B0-4751-B53C-36ACB6B0F8CC}~
~SYS_DIR$MYAH$MYAH$FALSE~
~~
~Comment~
~{1FFD47FD-23DF-4FDA-A30D-8C30AD3E9D8F}~
~~
~Set Variable~
~{F8BCCBA9-40E3-45E7-9AC9-5CD32BAEFCC5}~
~NATIVE_ENGINE$MYAH$MYAH$FALSE~
~TRUE~
~Set 64 Bit Mode~
~{D0535D7F-C13B-4351-BE12-D5B8FF009AF3}~
~FALSE~
~FALSE~
~TRUE~


Finally, some useful links;
https://www.installaware.com/forums/viewtopic.php?f=2&t=4603
https://www.installaware.com/forums/viewtopic.php?f=2&t=4338

Hope this helps you.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

SebSpiers
Posts: 38
Joined: Tue Dec 20, 2016 7:14 am
Location: Tewkesbury, UK

Re: File Copy Fails

Postby SebSpiers » Wed Dec 28, 2016 5:15 am

FRANCESCO! GENIUS!

You were correct, it was being redirected to C:\Windows\SysWOW64\inetsrv\Config despite me using an absolute path in the command line.

Resolved! Thank you!
I'm not a developer, I just want to install things...


Return to “Technical Support”

Who is online

Users browsing this forum: Google [Bot] and 48 guests