# PS1 to exe doesn't perform well

**URL:** <https://forums.powershell.org/t/ps1-to-exe-doesnt-perform-well/15279>\
**Category:** PowerShell Help\
**Created:** [November 23, 2020, 11:35pm UTC](https://forums.powershell.org/t/ps1-to-exe-doesnt-perform-well/15279 "2020-11-23T23:35:06Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![kunaguero](https://avatars.discourse-cdn.com/v4/letter/k/f9ae1b/32.png) [@kunaguero](https://forums.powershell.org/u/kunaguero)\
**Post date:** [November 23, 2020, 11:35pm UTC](https://forums.powershell.org/t/ps1-to-exe-doesnt-perform-well/15279/1 "2020-11-23T23:35:06Z")

</div>

Hello,

I have a script which should be running on dozens computers at the first time,  
so I need to `Set-ExecutionPolicy Unrestricted` before I run it. I’ve just **added the following line at the top of the script** :

`Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force`

or:

`Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Confirm:$false`

**work great within the ISE** , nothing happens when converting it to .exe

what I used to convert to .exe:

`# import module`  
`Install-Module -Name Sorlov.PowerShell`

`# export to .exe file`  
`New-SelfHostedPS -SourceFile C:\path\to\file.ps1 -DestinationFile C:\path\to\export.exe -HideConsole -IconPath C:\path\to\icon.ico -Version 2.0.0.0`

Admin privileges activated.

please help

---

<div class="post-metadata">

**Author:** ![grokkit](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/grokkit/32/970_2.png) [@grokkit](https://forums.powershell.org/u/grokkit)\
**Post date:** [November 24, 2020, 4:57am UTC](https://forums.powershell.org/t/ps1-to-exe-doesnt-perform-well/15279/2 "2020-11-24T04:57:54Z")

</div>

I’m not sure about converting to .exe, but you shouldn’t count on ISE as a test environment. The shell inside ISE isn’t the same as the actual PowerShell runtime; rather, it is an emulation of a console packaged inside a GUI app. [There are significant differences in the way ISE executes cmdlets and the way PowerShell itself executes them](https://devblogs.microsoft.com/powershell/differences-between-the-ise-and-powershell-console/).

On top of that, [ISE development has ended](https://docs.microsoft.com/en-us/powershell/scripting/windows-powershell/ise/introducing-the-windows-powershell-ise?view=powershell-7.1). Windows PowerShell v5.1 was the last version supported in ISE, but if your system is up to date you should be using PowerShell Core v7+.

So, you need to test your script either in VSCode or in the shell itself before trying to use it in your production environment. Testing done in ISE is not valid.

---

<div class="post-metadata">

**Author:** ![tonyd](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/tonyd/32/1041_2.png) [@tonyd](https://forums.powershell.org/u/tonyd)\
**Post date:** [November 24, 2020, 5:07am UTC](https://forums.powershell.org/t/ps1-to-exe-doesnt-perform-well/15279/3 "2020-11-24T05:07:40Z")

</div>

Have a look at ISE Steroids. Not free, but I have used it for a long time now to convert to EXE with no issues.

[http://www.powertheshell.com/](http://www.powertheshell.com/)

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![kunaguero](https://avatars.discourse-cdn.com/v4/letter/k/f9ae1b/32.png) [@kunaguero](https://forums.powershell.org/u/kunaguero)\
**Post date:** [November 24, 2020, 6:45pm UTC](https://forums.powershell.org/t/ps1-to-exe-doesnt-perform-well/15279/4 "2020-11-24T18:45:34Z")

</div>

> [@](#):
>
> ws PowerShell v

Thanks for your reply.

so what tool is the most suggested to create PowerShell scripts now?

I used to work with Visual Studio with the PowerShell extension and looking but it was still not comfortable as the ISE for me

---

<div class="post-metadata">

**Author:** ![krzydoug](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/krzydoug/32/1008_2.png) [@krzydoug](https://forums.powershell.org/u/krzydoug)\
**Post date:** [November 24, 2020, 7:06pm UTC](https://forums.powershell.org/t/ps1-to-exe-doesnt-perform-well/15279/5 "2020-11-24T19:06:09Z")

</div>

Regardless of all that if you have to change the execution policy in order to run a script you can’t run a script to change the execution policy. You’ll have to change it ahead of time or call powershell executable with -executionpolicy parameter

---

<div class="post-metadata">

**Author:** ![kunaguero](https://avatars.discourse-cdn.com/v4/letter/k/f9ae1b/32.png) [@kunaguero](https://forums.powershell.org/u/kunaguero)\
**Post date:** [November 24, 2020, 11:13pm UTC](https://forums.powershell.org/t/ps1-to-exe-doesnt-perform-well/15279/6 "2020-11-24T23:13:56Z")

</div>

[quote quote=273906]Regardless of all that if you have to change the execution policy in order to run a script you can’t run a script to change the execution policy. You’ll have to change it ahead of time or call powershell executable with -executionpolicy parameter

[/quote]

yes, that’s the best for me, worked great, thanks!

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:28pm UTC](https://forums.powershell.org/t/ps1-to-exe-doesnt-perform-well/15279/7 "2024-05-16T20:28:18Z")

</div>


