Questions tagged [executionpolicy]

A security setting for Windows PowerShell that enables you to determine which Windows PowerShell scripts (if any) will be allowed to run on your computer.

81 questions
3
votes
1 answer

Unable to Set Execution Policy for Gitlab CI/CD Pipeline

I have created an Amazon Alexa Skill and I have also added ask-cli support to it. When I was trying to deploy it using ask-cli an error came i.e. /bin/sh: 1: hooks/pre_deploy_hook.sh: Permission denied [Error]: Hook Scripts failed Then, I opened…
3
votes
1 answer

Powershell script fails when run via nant

I have several team members who can't run powershell scripts via nant. When they do, they get the ExectutionPolicy (not high enough, still set at the default value). However, they've run Set-ExecutionPolicy RemoteSigned in a powershell console, and…
kelloti
  • 8,705
  • 5
  • 46
  • 82
2
votes
1 answer

Why i can't change the policy from restricted to remote signed?

I hade a problem with 'touch' command , so someone tolled me that i should change the policy (in PowerShell) so I can run the script in vs code ,but the problem is that i couldn't change the policy from restricted to remote signed .
Suzy Ikram
  • 21
  • 1
2
votes
1 answer

Powershell Access is denied

I am getting an error "Access is denied" when I try to run a Powershell script: Set-Service : Service 'Windows Installer (msiserver)' cannot be configured due to the following error: Access is denied At C:\Dnload\9xAddons\Wordperfect.ps1:4 char:12 +…
Docfxit
  • 137
  • 3
  • 6
  • 15
2
votes
0 answers

Security policy is preventing running PS1 file on new windows 11 install regardless of ExecutionPolicy

I am trying to run jenv Java Enviroment Handler for windows and the ps1 file used is unsigned. This shouldn't be an issue since i set Process, CurrentUser and LocalMachine to Unrestricted yet the error still appears. I also tried setting these…
2
votes
2 answers

What is the best way to check PowerShell Execution Policy in C#?

When you run Get-ExecutionPolicy in PowerShell, it gets the effective execution policy. I need to know the best way to get that information in C#. I don't need to know how to change it like many other questions about PowerShell Execution Policy, I…
Unknown
  • 141
  • 7
2
votes
1 answer

Powershell script reports execution-policy error when in a console window from File Explorer

My script runs fine in ISE however not in a PowerShell console window. I have tried to replace any " with ' (just in case it was an encoding error but I am not sure). EDIT: The script works when copy and pasted into the console but not when opened…
h0pper
  • 75
  • 8
2
votes
2 answers

Execution Policy error when running powershell script from autohotkey

I have a simple autohotkey script !+l:: RunWait, PowerShell -NoExit -C "Import-Module D:\projects\changescreensaver\changescreensaver.psm1; Set-ScreenSaverTimeout 1;" But it won't let me load my ps profile or do the import-module and gives me an…
xdhmoore
  • 8,935
  • 11
  • 47
  • 90
2
votes
1 answer

How to configure ExecutionPolicy as "RemoteSigned" in Powershell 4.0 api

I need to configure ExecutionPolicy as 'RemoteSigned' at initial session state or somehow before execution of script. I don't want to execute script to set policy. This would alter the policy at client machine which i don't want. In Powershell 5.0…
Usman
  • 2,742
  • 4
  • 44
  • 82
2
votes
2 answers

How to make PowerShell prompt for un-signed scripts

The execution policy in my environment is AllSigned: PS E:\Temp> Get-ExecutionPolicy AllSigned When I try to execute a not trusted script it throws the error: & : File C:\temp\anz.ps1 cannot be loaded. The file C:\temp\any.ps1 is not digitally…
Jay Joshi
  • 1,402
  • 1
  • 13
  • 32
2
votes
1 answer

Roslyn Setup - Powershell Scripts

I've been trying to install the Rosyln source code from Github and following the build setup instructions. The first instruction is to run Restore.cmd - which produces the following error message: File C:\Code\roslyn-master\build\scripts\build.ps1…
Spodgy
  • 302
  • 5
  • 13
2
votes
1 answer

Self Elevating Script + Execution Policy

I'm trying to use the following code from th question "PowerShell: Running a command as Administrator" to not only self elevate my script to run automatically in an Administrator-level PowerShell, but also for the Administrator-level PowerShell…
Ikrananka
  • 25
  • 1
  • 3
2
votes
2 answers

Using invoke-command from C# throwing exception

I have tried the following case from powershell terminal : invoke-command -connectionuri "http://FullMachineName/wsman" -configuration "http ://schemas.microsoft.com/powershell/Microsoft.PowerShell" -credential "MachineName\Administrator" -filepath…
cmm user
  • 2,426
  • 7
  • 34
  • 48
1
vote
1 answer

PowerShell, only run Set-Execution if it is not already set?

I have a script that tries to run these... Set-ExecutionPolicy -scope CurrentUser RemoteSigned -Force -ea silent Set-ExecutionPolicy RemoteSigned -Force -ea silent But I get this error: Set-ExecutionPolicy : Windows PowerShell updated your…
YorSubs
  • 3,194
  • 7
  • 37
  • 60
1
vote
1 answer

Set-ExecutionPolicy unrestricted permission denied

I am trying to set the execution policy to Unrestricted, but I'm getting the following error: PS> Set-ExecutionPolicy Unrestricted Execution Policy Change The execution policy helps protect you from scripts that you do not trust. Changing the…