Fixing PowerShell “cannot be loaded because running scripts is disabled on this system”

Like many people this week, I was trying to run some official Microsoft PowerShell scripts related to “Meltdown” and “Spectre” bugs. But when I tried this, I encountered an error message from PowerShell, telling me that “SpeculationControl.psm1
cannot be loaded because running scripts is disabled on this system. For more information, see
about_Execution_Policies at https:/”

This is perfectly normal, it is a security feature that is easy to adjust when needed, and will apply to many scripts beyond just this week’s “speculative execution side-channel vulnerabilities” checkers. First things first, make sure you ran PowerShell as an Administrator – right click the icon in your Start Menu and click “Run as Administrator.” If it still doesn’t work, you need to change your Execution Policy. Follow these simple steps:

  1. type get-executionpolicy and press enter. Jot down the output for later, so you can re-secure your system (mine was “Restricted”).
  2. type set-executionpolicy remotesigned and press enter.
  3. Press “Y” and hit Enter to tell it you’re sure you want to change this setting.
  4. Now, run your desired script. It should output normally.
  5. After the script runs, I suggest setting your policy back to what it was. Again, mine was “restricted” so I type: set-executionpolicy restricted.
  6. Type “Y” and hit Enter to once again tell it that you want to change the policy.

And you’re done! I certainly hope that helped someone out there!