Script fails to run because the system policy disallows it.
PS E:\dev\repos\Get-WLANs> .\scan.ps1
.\scan.ps1 : File E:\dev\repos\Get-WLANs\scan.ps1 cannot be loaded because running scripts is disabled on this
system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ .\scan.ps1
+ ~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
To get around this, you must have admin privileges to change the execution policy.
Run powershell as Administrator.
# check current execution policy
> Get-ExecutionPolicy
> Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
# verify execution policy change
> Get-ExecutionPolicy
Run powershell as Administrator.
> Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy restricted