PowerShell error "running scripts is disabled on this system"
AdamY
Posts: 55 Bronze 3
I'm brand new to SQL Change Automation and am to the point where I'm trying to run some of the PowerShell scripts on my machine. I installed SQL Change Automation PowerShell 4.3.20267.22294 via the Toolbelt installation.
When running
When running
Invoke-DatabaseBuild
I get an error of:'Invoke-DatabaseBuild' command was found in the module 'SqlChangeAutomation', but the module could not be loaded. For more information, run 'Import-Modul SqlChangeAutomation'.
So then I run Import-Modul SqlChangeAutomation
and get the error of:
SqlChangeAutomation.psm1 cannot be loaded because running scripts is disabled on this system.
My PS execution policy is Restricted. Here is the confusing part:
- This older 2019 documentation says I have to update my PS execution policy to Unrestricted (I assume RemoteSigned would work, too).
- But the release notes from version 4.2.20177 (June 2020) says the scripts should run under Restricted mode.
Tagged:
Comments
The execution policy will need to be set to at least 'RemoteSigned' in order to import and run our scripts.
Restricted doesn't allow the execution of any scripts, so it is likely an error in our release notes. I'm really sorry about that!
I hope this works for you, but feel free to reply to this thread if there's still a problem, and I'll try my best to help resolve it.
Many thanks,
Dan