none
How to Set PowerShell execution policies for a large amount of users RRS feed

  • Question

  • I am trying to set the execution policy for more than 150 users.... I wrote a script, it runs with out error, but I confirmed with the user that the change wasn't made...

    $worstationobject = New-Object psobject    Hostname
    
    Add-Member -InputObject $worstationobject -MemberType NoteProperty -Name 'CORP\mkatherine'  -Value 'FooBar23'
    Add-Member -InputObject $worstationobject -MemberType NoteProperty -Name 'CORP\jshmoe'  -Value 'FooBar12'
    
    
    function Get-MemberValues {
       $wslist = $worstationobject.psobject.Members |
       ? {$_.Membertype -eq "noteproperty"} | 
       %{ $_.Value }
       $wslist -join ","
    }
    function Set-SAPolicies {
       $devices = Get-MemberValues
       Invoke-Command -InputObject $devices -ScriptBlock {Set-ExecutionPolicy RemoteSigned -Force}
    } 
    Any idea why this isn't working? 



    Tuesday, February 7, 2017 7:36 PM

Answers

  • Use Group Policy and set the first policy as network wide.  You can then set a policy for users that is more restrictive in the same Policy.  Set a group filter to choose the users.

    Post in GP forum for help with how to use Group Policy.


    \_(ツ)_/

    Tuesday, February 7, 2017 9:12 PM