0

I need to run scripts without user input. But recently my scripts have started to require input for the ExecutionPolicy.

I'd set the ExecutionPolicy previously via Set-ExecutionPolicy for all scopes to 'Unrestricted'. However, this was still leading to user input being required.

I've manually set the registry key for ExecutionPolicy to bypass but it's still using the unrestricted setting on all scopes.

It's not domained, so isn't pulling any GPOs from our DC.

The local GPO for execution policy allows all scripts.

I've tried setting the ExecutionPolicy to bypass using the command Set ExecutionPolicy -ExecutionPolicy bypass -Scope LocalMachine -Force which leads to the error setting is overridden by a policy defined at a more specific scope

I then tried Set-ExecutionPolicy -ExecutionPolicy bypass -Scope MachinePolicy -Force and it gave me the error

ExecutionPolicy must be set through Group Policy but as mentioned it's set to allow all scripts.

What am I doing wrong?

1 Answer 1

0

The answer was to set the Registry via Set-ItemProperty and not through regedit.

As soon as I ran this command Set-ItemProperty -Path HKLM:\Software\Policies\Microsoft\Windows\PowerShell -Name ExecutionPolicy -Value ByPass it showed correctly when listing Get-ExecutionPolicy

Unless there was an issue with capitalisation as it was set to 'bypass' rather than 'ByPass'

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.