Up until the end of last month 8/31/2022, I have had a functioning PS script that pings a server and sends an email with either 'All is well' or 'Problem!'. At or around 8/31 or 9/1, the emails stopped being sent, so I've begun to investigate. I have Win Task Scheduler for automating and its history shows that the bat file is being process/run as expected.
However, when I try to run the PowerShell script on its own as admin, I first received the error of:
Set-ExecutionPolicy : Windows PowerShell updated your execution policy successfully, but the setting is overridden by a policy defined at a more specific scope.
Here was my initial Get-ExecutionPolicy -List:
PS C:\WINDOWS\system32> Get-ExecutionPolicy -List
        Scope ExecutionPolicy
        ----- ---------------
MachinePolicy    RemoteSigned
   UserPolicy       Undefined
      Process       Undefined
  CurrentUser       Undefined
 LocalMachine    RemoteSigned
So I tried setting the ExecutionPolicy, via cmd line and regedit and gpedit.
When I ran Set-ExecutionPolicy -ExecutionPolicy Bypass in PS, I get the following error:
Set-ExecutionPolicy : Windows PowerShell updated your execution policy successfully, but the setting is overridden by a policy defined at a more specific scope.  Due to the override, your shell will retain its current effective execution policy of RemoteSigned. Type "Get-ExecutionPolicy -List" to view your execution policy settings. For more information please see "Get-Help Set-ExecutionPolicy".
At line:1 char:46
+ ...  -ne 'AllSigned') { Set-ExecutionPolicy -Scope Process Bypass }; & 'C ...
+                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : PermissionDenied: (:) [Set-ExecutionPolicy], SecurityException
    + FullyQualifiedErrorId : ExecutionPolicyOverride,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand
Then I run Get-ExecutionPolicy -List:
PS C:\WINDOWS\system32> Get-ExecutionPolicy -List
        Scope ExecutionPolicy
        ----- ---------------
MachinePolicy    RemoteSigned
   UserPolicy       Undefined
      Process       Undefined
  CurrentUser       Undefined
 LocalMachine    ByPass
And when I try to run the script now, PowerShell opens up, but hangs forever without running the script. This used to work, I don't know what has happened to make it not work.
There are many sites with different opinions of what needs to happen around the ExecutionPolicy. What do I need to do in order for this to work again? What are the definitive requirements? Honestly, I'd rather not use PowerShell as it always seems to have these 'permission' issues.
This may also be an issue: https://learn.microsoft.com/en-us/exchange/clients-and-mobile-in-exchange-online/deprecation-of-basic-authentication-exchange-online
but the article does not seem to provide a definitive 'fix'.
Many Thanks for any help!
UPDATED
thanks @mklement0, so I ran your Set... and my ExecutionPolicy is now as seen below. Is this correct?
Scope ExecutionPolicy
----- ---------------
MachinePolicy    Bypass
UserPolicy       Undefined
Process          Bypass
CurrentUser      Undefined
LocalMachine     RemoteSigned