I'm learning how to work with PowerShell fore remote command execution.
I created a simple script - test.ps1 - that contains just "dir", and executes well from command line. However, when I try to execute it using invoke-command, it fails with the following message. Note that for this test I'm trying localhost, but it still fails with a security message.
Command and message text:
PS Desktop> invoke-command -ComputerName localhost -FilePath test.ps1
invoke-command : File C:\Users\mirit.VENOTION\De
.ps1 cannot be loaded because running scripts is disabled on
this system. For more information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170
At line:1 char:1
+ invoke-command -ComputerName localhost -FilePath test.ps1
+ CategoryInfo : SecurityError: (:) [Invoke-Command], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess,Microso