I am trying to execute a powershell script through a batch file, at the moment I am only testing this to get it running so the .ps1 file is simply a hello world script.
This ALMOST works fine except there is a spanner to throw into the works;
I am trying to have the .ps1 stored in a remote location (on a shared NAS to be specific). This works when I have the .ps1 saved locally and point the .bat to the local .ps1.
However now that the .ps1 is in the remote location I am thrown with the following error;
"file (pathname) cannot be loaded. The file (pathname) is not digitally signed. The script will not execute on the system"
Now I am aware of execution policies and mine are as follows;
MachinePolicy = RemoteSigned UserPolicy = Undefined Process = Undefined CurrentUser = RemoteSigned LocalMachine = Bypass
I have tried changing CurrentUser to Bypass but I am thrown with the following;
Windows Powershell updated your execution policy successfully, but the setting is overridden by a policy defined at a more specific scope
Any ideas would be greatly appreciated!
Sorry if this has been a lot of information! If any of it is unclear feel free to ask me to clarify! I'm fairly new to all of this!