In PowerShell , there is a built-in security mechanism to prevent unrestricted script executions.
You can set this option by group policy or with Set-ExecutionPolicy cmdlet as an Administrator.
There are five different settings for the execution policy
Restricted. This is the default setting, and Windows PowerShell does not execute scripts, except for a few Microsoft-provided, digitally-signed scripts that contain shell configuration defaults.
RemoteSigned. This setting allows any script to be executed. However, remote scripts—those executed from a network location, those downloaded from the Internet using Internet Explorer, or those received in e-mail in Microsoft Office Outlook—must carry an intact, trusted digital signature.
AllSigned. This setting allows any script to execute provided it carries an intact, trusted digital signature.
Unrestricted. This setting allows any script to execute.
Bypass. This setting bypasses the execution policy entirely, allowing any script to execute. This setting is primarily intended for developers who embed the shell inside another application, where the developer plans to provide their own security model rather than using the shell’s own.