Please offer a working solution to NOT associate PowerShell Source files (e.g. ps1)

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 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
Jehoschua
Posts: 54
Joined: Fri Jan 29, 2016 6:23 am

Please offer a working solution to NOT associate PowerShell Source files (e.g. ps1)

Post by Jehoschua » Sun Apr 21, 2019 12:51 pm

Product: PowerShell Studio 2019 (64 Bit)
Build: v5.6.162
OS: Windows 10 Enterprise (64 Bit)
Build: v10.0.17134.0


Good evening

We just develop PowerShell Scripts on 2 or 3 days in a month,
the rest of the time we use PowerShell Scripts.

Therefore it is annoying that a double Click always opens the Sapien PowerShell Studio
and it's very annoying that there is no easy solution to prevent this behavior.

We tried the environmental variable before installing or upgrading:
$env:SKIP_FILEASSOCIATION = '1'
but it does not work.
Additionally, an environmental variable is a bad workaround, because if we forget it once, then we probably have to uninstall and reinstall Sapien PowerShell Studio, which is a real pain.

Therefore, we prefer a Registry-Setting, so that we can easily deploy it and it will never get forgotten :-)

Thanks a lot,
kind regards,
Thomas

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

Re: Please offer a working solution to NOT associate PowerShell Source files (e.g. ps1)

Post by Alexander Riedel » Sun Apr 21, 2019 1:53 pm

File associations are stored in the Windows registry and easy to set or reset using Windows PowerShell.
To do it manually, please see here: https://www.lifewire.com/how-to-change- ... ws-2624477
To automate the process, please look here: https://gallery.technet.microsoft.com/s ... e-3898f323
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
Jehoschua
Posts: 54
Joined: Fri Jan 29, 2016 6:23 am

Re: Please offer a working solution to NOT associate PowerShell Source files (e.g. ps1)

Post by Jehoschua » Sun Apr 21, 2019 3:11 pm

Thank you very much for searching a solution, but it would help if you propose working solutions...

On the one hand, neither of the two methods works,
on the other hand it is very tedious that Sapien Customers themselves have to find a reset each single association.

I guess that modifying the installer by ~2 lines of code

Code: Select all

If (not exists Disable-File-Association registry key) {
  Setup-File-Associations()
}
would be much less time-consuming than searching for tedious workarounds.

It would really help a lot to fix the root of the problem - especially because it's really trivial to solve.

Kind regards,
Thomas

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

Re: Please offer a working solution to NOT associate PowerShell Source files (e.g. ps1)

Post by Alexander Riedel » Sun Apr 21, 2019 6:14 pm

I tested them both before suggesting them and they both operate exactly as described, quick, easy and precise.
I am not really sure what is so tedious about that, since you can completely script it.

You propose that you need to set a registry key. I apologize for maybe sounding a little puzzled, but file associations are registry key based.
So your solution is not any different than modifying the file association directly to your liking.
Which will allow you to reset ANY unwanted file association modification.
Alexander Riedel
SAPIEN Technologies, Inc.