Packaged MSI only copies contained PS1 instead of running it

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 8 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
WSUsoftware
Posts: 30
Last visit: Thu Feb 17, 2022 2:52 pm

Packaged MSI only copies contained PS1 instead of running it

Post 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
Attachments
ADConsolex64Windows10.ps1
(6.19 KiB) Downloaded 268 times
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

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

Post 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.
User avatar
WSUsoftware
Posts: 30
Last visit: Thu Feb 17, 2022 2:52 pm

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

Post 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.
User avatar
Alexander Riedel
Posts: 8478
Last visit: Tue Mar 26, 2024 8:52 am
Answers: 19
Been upvoted: 37 times

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

Post 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.
Alexander Riedel
SAPIEN Technologies, Inc.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

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

Post 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.
User avatar
WSUsoftware
Posts: 30
Last visit: Thu Feb 17, 2022 2:52 pm

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

Post 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.
User avatar
WSUsoftware
Posts: 30
Last visit: Thu Feb 17, 2022 2:52 pm

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

Post 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
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

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

Post 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.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

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

Post 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.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

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

Post 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.
This topic is 8 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked