1

I am trying to run a signed PS script from a cmd window using this command:

powershell.exe -ExecutionPolicy bypass -File \\server01.company.local\emp\TestParams2.ps1 myserver "\\server1\folder name\file.txt" 9999

When I do, I get this:

[D] Do not run  [R] Run once  [S] Suspend  [?] Help (default is "D"):

I signed the script and it is not blocked. AND I can run it from other servers in the same zone and subject to the same group policies, logged in as the same user, without having this confirmation request come up. I must have a setting that is specific to this machine that is blocking it, but I can't figure it out. These are the current execution policies:

powershell Get-executionpolicy -list

        Scope ExecutionPolicy
        ----- ---------------
MachinePolicy    Unrestricted
   UserPolicy    Unrestricted
      Process       Undefined
  CurrentUser          Bypass
 LocalMachine          Bypass

What am I missing?

Dale K
  • 25,246
  • 15
  • 42
  • 71
cashonly
  • 119
  • 9
  • I guess that is because your script is remote and not in a trusted zone (internet zone setting) try to run the script from a local drive or using the netbios name: `\\server01\emp\TestParams2.ps1` – iRon Nov 14 '19 at 16:53
  • @iRon, it does run locally. Do you know where I could look to find out the differences between the zone for this server and for the server that it does work on? – cashonly Nov 14 '19 at 17:59
  • 1
    Your result is expected, because your machine and user policy are set to `Unrestricted` rather than `Bypass`. See `help about_Execution_Policies`. – Bill_Stewart Nov 14 '19 at 18:08
  • Apart from what what @Bill_Stewart commented, your (trusted) zone settings are defined in your internet settings. – iRon Nov 14 '19 at 18:18
  • Does this answer your question? [Ignore 'Security Warning' running script from command line](https://stackoverflow.com/questions/728143/ignore-security-warning-running-script-from-command-line) – iRon Nov 14 '19 at 18:19

0 Answers0