Support Forums

Packaged MSI only copies contained PS1 instead of running it

Ask your Windows PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.
User avatar
hamsandwich
Posts: 16
Joined: Thu Nov 20, 2014 12:05 pm

Packaged MSI only copies contained PS1 instead of running it

Postby hamsandwich » Tue Feb 16, 2016 11:19 am

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 108 times
User avatar
jvierra
Posts: 10032
Joined: Tue May 22, 2007 9:57 am
Contact:

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

Postby jvierra » Tue Feb 16, 2016 11:41 am

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
hamsandwich
Posts: 16
Joined: Thu Nov 20, 2014 12:05 pm

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

Postby hamsandwich » Tue Feb 16, 2016 12:37 pm

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: 5865
Joined: Tue May 29, 2007 4:43 pm

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

Postby Alexander Riedel » Tue Feb 16, 2016 12:54 pm

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.
User avatar
jvierra
Posts: 10032
Joined: Tue May 22, 2007 9:57 am
Contact:

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

Postby jvierra » Tue Feb 16, 2016 1:04 pm

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
hamsandwich
Posts: 16
Joined: Thu Nov 20, 2014 12:05 pm

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

Postby hamsandwich » Tue Feb 16, 2016 1:10 pm

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
hamsandwich
Posts: 16
Joined: Thu Nov 20, 2014 12:05 pm

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

Postby hamsandwich » Tue Feb 16, 2016 1:20 pm

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
User avatar
jvierra
Posts: 10032
Joined: Tue May 22, 2007 9:57 am
Contact:

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

Postby jvierra » Tue Feb 16, 2016 1:45 pm

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.
User avatar
jvierra
Posts: 10032
Joined: Tue May 22, 2007 9:57 am
Contact:

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

Postby jvierra » Tue Feb 16, 2016 1:45 pm

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.
User avatar
jvierra
Posts: 10032
Joined: Tue May 22, 2007 9:57 am
Contact:

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

Postby jvierra » Tue Feb 16, 2016 1:49 pm

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.

Return to “Windows PowerShell”

Who is online

Users browsing this forum: No registered users and 2 guests