Home > Enterprise >  Trying to run the multiple powershell scripts from wix installer
Trying to run the multiple powershell scripts from wix installer

Time:12-04

Here I have tried something but it dose not work at all can anyone guide me how to run the multiple scripts from installer

<SetProperty Id="PS1"
         Before="PS1"
         Sequence="execute"
             Value ="&quot;C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe&quot;-NoLogo -NonInteractive -ExecutionPolicy Bypass -InputFormat None -NoProfile -File &quot;-Command &quot;cd '[INSTALLLOCATION]'; &amp; '[#ps1]' ; exit $$($Error.Count)&quot;" />


<CustomAction Id="PS1" 
              BinaryKey="WixCA" 
              DllEntry="WixQuietExec" 
              Execute="deferred" 
              Return="check" 
              Impersonate="no" />
        
<InstallExecuteSequence>
    <Custom Action="PS1" After='InstallFiles'>
        <![CDATA[NOT Installed]]>
    </Custom>
</InstallExecuteSequence>

to destination folder files get copied but it said like this why I dont know ,Inside a log file it shows like this


WixQuietExec:  Processing -File '-Command cd' failed because the file does not have a '.ps1' extension. Specify a valid Windows PowerShell script file name, and then try again.
WixQuietExec:  Windows PowerShell
WixQuietExec:  Copyright (C) Microsoft Corporation. All rights reserved.
WixQuietExec:  
WixQuietExec:  Try the new cross-platform PowerShell https://aka.ms/pscore6
WixQuietExec:  
WixQuietExec:  Error 0xfffd0000: Command line returned an error.
WixQuietExec:  Error 0xfffd0000: QuietExec Failed
WixQuietExec:  Error 0xfffd0000: Failed in ExecCommon method
CustomAction PS1 returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)

CodePudding user response:

This doesn't always happen, but the error message is pretty clear. Here it is word-wrapped, so it is easier to read:

WixQuietExec:  Processing -File '-Command cd' failed because 
               the file does not have a '.ps1' extension. 
               Specify a valid Windows PowerShell script file
               name, and then try again.

That's a PowerShell error message.

  • Related