Page 1 of 2

Packaged MSI only copies contained PS1 instead of running it

Posted: Tue Feb 16, 2016 10:19 am
by WSUsoftware
I have a powershell script that enables select Remote Administration Tools. The script works when you run it, however I am having some issues when I try to deploy it. One way I tried is packaging it in an exe using PowershellStudio2015 package builder. The exe works, but when I try to run it using a zap file, it does not work. I also tried using an msi using the installer tool in PowershellStudio 2015. The msi starts and you see the configuration step for a second or two and then it closes. When you go to the folder where the "program" should be installed, the ps1 file is there but it hasn't been run. What am I missing? Attached is the ps1 file

Re: Packaged MSI only copies contained PS1 instead of running it

Posted: Tue Feb 16, 2016 10:41 am
by jvierra
The PS1 file is meaningless since it does not get installed. Are you sure you are using the correct MSI build for the target system?
Be sure to sign the file as some systems will not allow unsigned MSI files.

Re: Packaged MSI only copies contained PS1 instead of running it

Posted: Tue Feb 16, 2016 11:37 am
by WSUsoftware
jvierra wrote:The PS1 file is meaningless since it does not get installed. Are you sure you are using the correct MSI build for the target system?
Be sure to sign the file as some systems will not allow unsigned MSI files.
As far as settings go, I don't see anything that would be causing an issue. I tried all the different "Product Type"' and none of them worked. Also tried the different MSI options, all checked or unchecked, as far as signing, none of our other scripts are signed and that hasn't been an issue.

Re: Packaged MSI only copies contained PS1 instead of running it

Posted: Tue Feb 16, 2016 11:54 am
by Alexander Riedel
An MSI file is an installer. You use it to deploy software (of any kind) to an end users system. It gets installed and gets an optional shortcut.
It is up to the end user to run your script or exe or whatever you are rolling out.
"The exe works, but when I try to run it using a zap file, it does not work. " There is no "this does not work" error message. :D So you will need to be a little bit more specific.

Re: Packaged MSI only copies contained PS1 instead of running it

Posted: Tue Feb 16, 2016 12:04 pm
by jvierra
Don't use a ZAP file to publish. Just generate an MSI and use that. In all cases you cannot automatically execute the exe file.

Published packages are either system or user specific. It user then they are voluntary and the user must subscribe. An MSI can have an included post install script which can be used to execute the exe that has been installed.

ZAP files are for NON-MSI setup or install files. They are not intended to be used to run an EXE.

As Alex notes. You need to clarify what you are trying to do.

Re: Packaged MSI only copies contained PS1 instead of running it

Posted: Tue Feb 16, 2016 12:10 pm
by WSUsoftware
Alexander Riedel wrote:An MSI file is an installer. You use it to deploy software (of any kind) to an end users system. It gets installed and gets an optional shortcut.
It is up to the end user to run your script or exe or whatever you are rolling out.
"The exe works, but when I try to run it using a zap file, it does not work. " There is no "this does not work" error message. :D So you will need to be a little bit more specific.
So as far as MSI installer is concerned its only job as far as a ps1 file is concerned is to put it there? So that will not run the ps1? I guess I assumed is worked similarly to what happens when you package it as an exe.

The .zap file is what we use to publish? Our programs to the control panel via group policy. So what I'm saying is the exe works when run alone but trying to install from the control panel does not work. I tried digging through event viewer to find answers but I couldn't find anything useful(although to be honest I don't know much. I'm only a student worker and my boss doesn't know either), google hasn't been helpful either.

Re: Packaged MSI only copies contained PS1 instead of running it

Posted: Tue Feb 16, 2016 12:20 pm
by WSUsoftware
To clarify this is how my work installs things on computers:
-Get install files from vendors (exe's, MSI's, licenses, etc)
-That gets thrown in a network folder
-A script is written (usually VBS or PS1) that runs the installers as well as any other additional things we want it to do
-That script is thrown in the same network folder
-There is also a ZAP file that is created for each script that is written. That ZAP contains the FriendlyName and SetupCommand.
-For SetupCommand there are two different arguments we use:
---For VBS scripts it is: "C:\Windows\System32\cscript.exe networklocation\script.vbs"
---For Powershell it is: "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe networklocation\script.ps1"
-The ZAP file then gets pushed to the control panel, install program from network area using group policy.
-The users just open up the control panel and install programs through the control panel

Re: Packaged MSI only copies contained PS1 instead of running it

Posted: Tue Feb 16, 2016 12:45 pm
by jvierra
Do not use a ZAP file. It cannot publish an EXE. It can only publish EXE based installers. You need to use an MSI. Group Policy can publish MSI files directly.

Re: Packaged MSI only copies contained PS1 instead of running it

Posted: Tue Feb 16, 2016 12:45 pm
by jvierra
Do not use a ZAP file. It cannot publish an EXE. It can only publish EXE based installers. You need to use an MSI. Group Policy can publish MSI files directly.

Re: Packaged MSI only copies contained PS1 instead of running it

Posted: Tue Feb 16, 2016 12:49 pm
by jvierra
hamsandwich wrote:To clarify this is how my work installs things on computers:
-Get install files from vendors (exe's, MSI's, licenses, etc)
-That gets thrown in a network folder
-A script is written (usually VBS or PS1) that runs the installers as well as any other additional things we want it to do
-That script is thrown in the same network folder
-There is also a ZAP file that is created for each script that is written. That ZAP contains the FriendlyName and SetupCommand.
-For SetupCommand there are two different arguments we use:
---For VBS scripts it is: "C:\Windows\System32\cscript.exe networklocation\script.vbs"
---For Powershell it is: "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe networklocation\script.ps1"
-The ZAP file then gets pushed to the control panel, install program from network area using group policy.
-The users just open up the control panel and install programs through the control panel
I think you miss the point of the AP file here. It uses a PS1 to do an install of an exe or other file. You must place you file in the install folder and write a vbs or exe to install the file. You cannot wrap the install script in an exe and have it work as a ZAP installer.