Are all in AD.
Only one group of users is in workgroup.
On these I get the following error (just because I not run the command manually as administrator):
Set-ExecutionPolicy: Access is denied to the key 'HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ PowerShell \ 1 \ ShellIds \ Microsoft.PowerShell 'registry.
To change the default execution policy scope (LocalMachine)
start Windows PowerShell with the "Run as administrator". for
change the execution policy for the current user, run
"Set-ExecutionPolicy-Scope CurrentUser".
In C: \ Users \ Walter \ Desktop \ test_mail.ps1: 1 car: 1
+ Set-ExecutionPolicy 'Unrestricted'-Force
+ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
+ CategoryInfo: PermissionDenied: (:) [Set-ExecutionPolicy], A
uthorizedAccessException
+ FullyQualifiedErrorId: System.UnauthorizedAccessException, Microsoft.Pow
erShell.Commands.SetExecutionPolicyCommand
my ultimate goal is just to run powerrshell script as administrator without start manually Windows PowerShell with the "Run as administrator"