Exercise 2: "Running Scripts Is Disabled on This System" — Possible Solution ==================================================================== WHY DOUBLE-CLICKING THE SCRIPT DID NOTHING ------------------------------ Double-clicking a .ps1 file doesn't run it in a visible terminal by default the way an .exe or .bat file would - PowerShell's default file association for .ps1 is actually configured to open it in a text editor rather than execute it, precisely because silently double-click-running arbitrary scripts is considered a real security risk. This is why nothing appeared to happen at all. WHAT THE ERROR MEANS ONCE RUN FROM A TERMINAL ------------------------------ Per this chapter, "the default Execution Policy (Restricted) blocks all scripts, downloaded or otherwise." Running the script directly from a PowerShell terminal bypasses the double-click file-association issue, but exposes the real underlying block: Windows's default Execution Policy setting simply refuses to run any script at all, regardless of where it came from, until that policy is changed. WHY THIS ISN'T SPECIFIC TO THIS ONE SCRIPT ------------------------------ This has nothing to do with anything wrong in the script's own content - per this chapter, Restricted "blocks all scripts, downloaded or otherwise," meaning even a completely harmless, locally written script would fail with the exact same error on a machine still using the default policy. THE RECOMMENDED FIX ------------------------------ Per this chapter's own warn-box, the fix is Set-ExecutionPolicy RemoteSigned, which "allows locally written scripts to run freely while still requiring downloaded scripts to be digitally signed - a real, deliberate middle ground, not something to bypass entirely with Unrestricted just to make an error go away." This means that even after this fix, an unsigned script downloaded from the internet - like the one in this scenario - would still be blocked unless it carries a valid digital signature, since RemoteSigned specifically distinguishes local scripts from downloaded ones rather than opening the door to everything equally. WHY THIS WORKS AS AN ANSWER ------------------------------ It explains why double-clicking produced no visible result, identifies Execution Policy (not the script's own content) as the actual blocker once run from a terminal, and gives the specific recommended fix from this chapter's own warn-box while correctly noting that RemoteSigned still wouldn't automatically permit this particular unsigned downloaded script to run.