0

I was running a script just fine on my PC. It crashed and I got a new one and I keep getting this error. (File C:\Users\19257\Desktop\DriveMaps.ps1 cannot be loaded because running scripts is disabled on this system.) So, I know the script if good. It runs on other people's computers.

WHAT I HAVE TRIED.

  1. Verified my PC is in the correct AD OU. Same as everyone else that can run the script.
  2. I ran PowerShell as admin and tried these commands and get the same error.
  • Set-ExecutionPolicy RemoteSigned
  • Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
  • Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
  1. My setting are currently like this:
Scope ExecutionPolicy
----- ---------------
MachinePolicy       Undefined
   UserPolicy       Undefined
      Process       Undefined
  CurrentUser       Undefined
 LocalMachine       Undefined
mklement0
  • 382,024
  • 64
  • 607
  • 775
phillyd
  • 9
  • 1

1 Answers1

-2

I figured it out. Instead of running Set-ExecutionPolicy RemoteSigned in PowerShell as admin. I ran it in PowerShell ISE as admin and it worked!

phillyd
  • 9
  • 1
  • 1
    It's commendable that you're trying to show others what worked (I didn't down-vote), but note that execution policies aren't tied to a particular host. In order to set the `LocalMachine` policy, the only thing that matters is whether your session - whether in the IDE or in a regular console window - is elevated or not. Therefore, I don't think your solution will help future readers. – mklement0 Dec 23 '20 at 16:00