MSI plus batch file

Support for all customers who have purchased a SAPIEN PowerShell Studio product license. This forum does not offer a response time guarantee.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
PXL_Posh
Posts: 31
Joined: Wed Jan 10, 2018 9:37 am

MSI plus batch file

Post by PXL_Posh » Wed Jun 13, 2018 7:27 am

Powershell Studio 2018 64 bit
Windows 10 64bit VM

Does a batch file require any special arguments to run?
I opened the MSI with ORCA and it seems to be plainly calling the file.bat.
When manually run the batch file successfully adds the registry entry without error.

Confirmed the following:
  • The bat is added to the imported files.
    Batch file called without argument.
    With and Without system account (no impersonation) enabled.

The installer fails every time on the batch file.
Eventviewer points to the batch file.

Thank you

User avatar
Alexander Riedel
Posts: 6567
Joined: Tue May 29, 2007 4:43 pm

Re: MSI plus batch file

Post by Alexander Riedel » Wed Jun 13, 2018 8:44 am

Try adding it as
cmd /c file.bat
I am assuming this is for a custom action?
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
PXL_Posh
Posts: 31
Joined: Wed Jan 10, 2018 9:37 am

Re: MSI plus batch file

Post by PXL_Posh » Wed Jun 13, 2018 10:20 am

Custom action is correct.

File: cmd.exe
Folder: SystemFolder
Argument: /c [installdir]file.bat

Does this look correct?

Update: This did not work

Error 1722. There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor. Action Unrestricted, location: C:\Windows\SysWOW64\, command: cmd.exe /c C:\Program Files\Contoso\AdminToolKit\file.bat

Running c:\windows\syswow64\cmd.exe /c C:\Program Files\Contoso\AdminToolKit\file.bat failed
Changing syswow64 to system32 succeeded by executing it in the windows run line:

c:\windows\system32\cmd.exe /c C:\Program Files\Contoso\AdminToolKit\file.bat succeeded

Just have to figure out how to make it use system32, changing it to windowsfolder did not succeed.

User avatar
Alexander Riedel
Posts: 6567
Joined: Tue May 29, 2007 4:43 pm

Re: MSI plus batch file

Post by Alexander Riedel » Wed Jun 13, 2018 10:52 am

Specify C:\Windows\Sysnative\cmd.exe
That should call the right thing on 32 and 64 bit machines
(Note: I did not try that)
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
PXL_Posh
Posts: 31
Joined: Wed Jan 10, 2018 9:37 am

Re: MSI plus batch file

Post by PXL_Posh » Wed Jun 13, 2018 11:16 am

How would I organize that in the setup?

File: cmd.exe
Folder: C:\Windows\Sysnative
Argument: /c [installdir]file.bat

Did not accept folder.


File: C:\Windows\Sysnative\cmd.exe
Folder: ( cannot be blank ) INSTALLDIR
Argugment: /c [installdir]file.bat

did not like command


File: cmd.exe
Folder: INSTALLDIR
Argument: c:\windows\system32\cmd.exe /c [installdir]file.bat

Did not work.

User avatar
Alexander Riedel
Posts: 6567
Joined: Tue May 29, 2007 4:43 pm

Re: MSI plus batch file

Post by Alexander Riedel » Wed Jun 13, 2018 1:08 pm

Please be a little more precise in your post. "Did not accept folder.", for example. The dev team tells me they do not validate folders, so you need to tell who did not accept what.
"Did not like command". I doubt there was a messagebox that said "Ew, I do not like this command" :D
And "did not work" can be oh so many things.
Please provide the actual error message or screenshots.
Alexander Riedel
SAPIEN Technologies, Inc.