Alternative way to create a shortcut from MSI

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION 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.
This topic is 4 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.
User avatar
IMI_NIVELLII
Posts: 6
Last visit: Mon Nov 07, 2022 1:12 am

Alternative way to create a shortcut from MSI

Post by IMI_NIVELLII »

Product, version and build: Powershell Studio 2020 5.7.172
32 or 64 bit version of product: 64 bit
Operating system: Windows 10
32 or 64 bit OS: 64 bits

Hello,

Recently we have created a little program with Powershell Studio and we need to deploy it through all computers of the company, so we have created a MSI file. When we install the MSI file, it creates automatically the shortcuts in the Start Menu, but we need them to be installed in the users desktop. For this purpose we've found this guide https://www.sapien.com/blog/2019/08/15/ ... xecutable/ and it works, but for me it has two problems:
  • The create an delete scripts are needed to be copied in the installation folder to be executed.
    The scripts won't be executed unless I change the Powershell execution Policy form "restricted".
I know I could sign this scripts and change the policy to "Allsigned", for example, but I think perhaps could be another way integrated with the MSI.

Thanks in advance
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: Alternative way to create a shortcut from MSI

Post by Alexander Riedel »

A custom action doesn't need to be a script. Package the script that does what you want as an executable and include that as a custom action in your MSI.
That will avoid the execution policy requirement.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
IMI_NIVELLII
Posts: 6
Last visit: Mon Nov 07, 2022 1:12 am

Re: Alternative way to create a shortcut from MSI

Post by IMI_NIVELLII »

Alexander Riedel wrote: Sun Feb 09, 2020 11:43 pm A custom action doesn't need to be a script. Package the script that does what you want as an executable and include that as a custom action in your MSI.
That will avoid the execution policy requirement.
Thanks Alexander, I'll give a try.

So, there would be a way to hide these executables on the INSTALLDIR?

Thanks you
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: Alternative way to create a shortcut from MSI

Post by Alexander Riedel »

Hide? I am not sure I understand. Why do you want to hide the files? From whom?
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
IMI_NIVELLII
Posts: 6
Last visit: Mon Nov 07, 2022 1:12 am

Re: Alternative way to create a shortcut from MSI

Post by IMI_NIVELLII »

Thanks you for answer me.

When we install the MSI file with the two scripts as CUSTOM ACTION (or executables if we do what you suggested), it copies the main file program in the folder "%programfiles%\[name of the program]" as expected, but in this folder there are too copied the two scripts "CreateShortcut" and "DeleteShortcut". This files are what I would like to not be showed.

Regards
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: Alternative way to create a shortcut from MSI

Post by Alexander Riedel »

I am not sure why you want them to be invisible.
I am assuming here you do not want a user to just click on them and potentially delete shortcuts or duplicate them.
You can either package these exe's with an elevation manifest to prevent a regular user from running them. The installer runs elevated usually so they would execute just fine.
Or you can add a parameter -key 2834287347238434 (or some such number) to the exe. If present it does the job, if not, it just says "You are not authorized to perform this operation".
From the custom action you can just add that parameter and no user would ever know :D

You could add a hidden attribute to the files but I am not certain if the MSI will be able to execute hidden files. And they are easily discovered anyway. So I would not recommend that.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
IMI_NIVELLII
Posts: 6
Last visit: Mon Nov 07, 2022 1:12 am

Re: Alternative way to create a shortcut from MSI

Post by IMI_NIVELLII »

Thanks you very much for the help.
This topic is 4 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.