Profile Sync PowerShell Problem RRS feed

  • Question

  • Morning all,

    Im running the following command to sync usernames with AD:

    Get-SPUser –Web http://sharepoint ¦ Set-SPUser –SyncFromAD

    But i get the following error:

    PS C:\Users\adminmj$> cd\
    PS C:\> Get-SPUser -Web http://sharepoint ¦ Set-SPUser -SyncFromAD
    Get-SPUser : A positional parameter cannot be found that accepts argument 'Set-
    At line:1 char:11
    + Get-SPUser <<<<  -Web http://sharepoint ¦ Set-SPUser -SyncFromAD
        + CategoryInfo          : InvalidArgument: (:) [Get-SPUser], ParameterBind
        + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.SharePoint

    PS C:\>

    Any help would be much appreciated.



    Friday, July 13, 2012 8:47 AM

All replies

  • How about getting a user via one of the following way:

    $webSite = Get-SPWeb $siteURL

    $user = $webSite.AllUser("<user name>")

    Or try this:

    $user = $webSite.EnsureUser("<User Name>")

    SharePoint Developer

    Friday, July 13, 2012 7:01 PM