tomrijndorp / vscode-finditfaster

Find it, but faster! Fast file search for VS Code.
MIT License
252 stars 25 forks source link

Powershell Scripts Execution Policy #78

Open gberrante opened 2 months ago

gberrante commented 2 months ago

Hello, on windows i get this error relative to the execution policy of the extension powershell scripts. I can run them indivisually from the external terminal.

Failed to run checks before starting extension. Maybe this is helpful: Error: Command failed: powershell c:\Users\xxx\.vscode\extensions\tomrijndorp.find-it-faster-0.0.31\flight_check.ps1
c:\Users\xxx\.vscode\extensions\tomrijndorp.find-it-faster-0.0.31\flight_check.ps1 : File 
C:\Users\xxx\.vscode\extensions\tomrijndorp.find-it-faster-0.0.31\flight_check.ps1 cannot be loaded. The file 
C:\Users\xxx\.vscode\extensions\tomrijndorp.find-it-faster-0.0.31\flight_check.ps1 is not digitally signed. You 
cannot run this script on the current system. For more information about running scripts and setting execution policy, 
see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ c:\Users\xxx\.vscode\extensions\tomrijndorp.find-it-faster-0.0.31\ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

Current Policy on my WIndows: Scope ExecutionPolicy


MachinePolicy Undefined UserPolicy Undefined Process Bypass CurrentUser Bypass LocalMachine Bypass

GuillermoCruz27 commented 2 months ago

I have the same problem, I'm using as default terminal Powershell 7(pwsh) in VS Code

hyvnova commented 2 months ago

Same here. Powershell 7

dmorozov82 commented 2 months ago

Same story ;( need to change execution policy

tomrijndorp commented 2 months ago

Hi all, I rely on community contributions for Windows support as I'm not a Windows user myself. I'd appreciate any pointers towards how to address this and please feel free to open a PR.

Edit: maybe somebody can tell me whether this approach is appropriate and whether it fixes the issue: https://stackoverflow.com/a/67420296/888916

lightspeedlucas commented 2 months ago

Edit: maybe somebody can tell me whether this approach is appropriate and whether it fixes the issue: https://stackoverflow.com/a/67420296/888916

That did not work for me, but this did: https://www.donovanbrown.com/post/Using-PowerShell-in-VS-Code. I'm not familiar with PowerShell either, so I'm not sure how one would fix the extension itself. But hopefully that workaround works for others, like myself, coming from google.

Luiggi33 commented 2 months ago

That did not work for me, but this did: donovanbrown.com/post/Using-PowerShell-in-VS-Code. I'm not familiar with PowerShell either, so I'm not sure how one would fix the extension itself. But hopefully that workaround works for others, like myself, coming from google.

If I am not mistaken, this wont sadly fix the issue at hand. It's a workaround to get it to work, but not a permanent solution sadly :/ The most obvious solution is just to sign the Powershell script, even tho I have never done that myself Its too expensive to sign it, I will try and put together a PR to maybe address this

PaoloJr90 commented 2 months ago

I tried similar steps to @gberrante using these PowerShell docs to no avail. I can run the flight_check.ps1 script directly in PowerShell (Windows Terminal - Admin mode) and PowerShell in VSCode (non-admin mode) with the relevant Execution Policy set to undefined

marcogmaia commented 2 months ago

What worked for me was to change the execution policy of the default Windows Powershell, instead of the Powershell 7.

Luiggi33 commented 2 months ago

Sadly these are all just bandaid fixes for a bigger problem. If someone wanted to use this extension on a company PC that restricts their PowerShell execution policy, that would make this extension unusable :/

DarksideVT commented 1 month ago

This is still an issue for me after I set the execution policy. My user name has a space character so when the flight_check.ps1 runs, it gets the incorrect path.