locked
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-
    SPUser'.
    At line:1 char:11
    + Get-SPUser <<<<  -Web http://sharepoint ¦ Set-SPUser -SyncFromAD
        + CategoryInfo          : InvalidArgument: (:) [Get-SPUser], ParameterBind
       ingException
        + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.SharePoint
       .PowerShell.SPCmdletGetUser

    PS C:\>

    Any help would be much appreciated.

    Thanks


    Martin

    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