none
Script to run against ALL AD users in a loop RRS feed

  • Question

  • I am going to do a SharePoint upgrade this weekend from 2010 to 2013.

    I need this script to run against every Active Directory user automatically, not just one at a time. How do I get this get this script to do that? I figure I create a pipeline, I just don't know where.

    Here is the script:

    Param(
        [string]  $account = $(Read-Host -prompt "UserAccount")
        )
    Add-PSSnapIn Microsoft.SharePoint.PowerShell
     
    foreach ($wa in get-SPWebApplication)
    {
        Write-Host "$($wa.Name) | $($wa.UseClaimsAuthentication )"
        #http://technet.microsoft.com/en-us/library/gg251985.aspx
        $wa.UseClaimsAuthentication = $true
        $wa.Update()
        $account = (New-SPClaimsPrincipal -identity $account -identitytype 1).ToEncodedString()
        $zp = $wa.ZonePolicies("Default")
        $p = $zp.Add($account,"PSPolicy")
        $fc=$wa.PolicyRoles.GetSpecialRole("FullControl")
        $p.PolicyRoleBindings.Add($fc)
        $wa.Update()
        $wa.MigrateUsers($true)
        $wa.ProvisionGlobally()
    }

    Please help me! Thank you!

    Monday, November 3, 2014 6:10 PM

All replies