SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have a SharePoint 2010 site deployed using powershell. Before running script we have to create a web application and site collection. Then run the script. The script creates groups and lists.

Now, in SP2013, if we run the powershell, then foll code gives error:-

if ($SPWeb.Site.WebApplication.UseClaimsAuthentication){
        $op = New-SPClaimsPrincipal $OwnerName -IdentityType WindowsSamAccountName
        $mp = New-SPClaimsPrincipal $MemberName -IdentityType WindowsSamAccountName
        $owner = $SPWeb | Get-SPUser $op  //error is on this line
        $member = $SPWeb | Get-SPUser $mp
    else {
    $owner = $SPWeb | Get-SPUser $OwnerName
        if ($MemberName) {
            $member = $SPWeb | Get-SPUser $MemberName

Error is:-

Get-SPUser : You must specify a valid user object or user identity.

SharePoint 2010 sites are classic mode authentication and it looks like SharePoint 2013 by default create site as claims mode. I would like to know whether there is any solution to this error.

To resolve it, I have created an Classic mode authentication site in SharePoint 2013 via powershell:-

New-SPWebApplication -Name "My web app" -ApplicationPool "Web app pool1" -AuthenticationMethod "NTLM" -ApplicationPoolAccount (Get-SPManagedAccount "CONTOSO\nash") -Port 7777

When running this command, I get warning as:-

WARNING: The Windows Classic authentication method is deprecated in this release and the default behavior of this cmdlet, which creates Windows Classic based we b application, is obsolete. It is recommended to use Claims authentication methods. You can create a web application that uses Claims authentication method by s pecifying the AuthenticationProvider parameter set in this cmdlet. Refer to the site for more information. Please note that the default behavior of this cmdlet is expected to change in the future release to create a Claims authentication based web application instead of a W indows Classic based web application.

Once this is done, the powershell code to create lists/groups and deploy webparts runs all well.

  1. Is there any solution for the script throwing error in SP2013, besides having to create the site via powershell as classic mode which is now deprecated?

  2. Is this good practice to create and use classic mode authentication site in SP2013?

share|improve this question
up vote 2 down vote accepted

Once you run the script for creating groups and list in classic based SP 2013 site, you can then convert it to use claims authentication using PowerShell:

Convert-SPWebApplication -Identity "http://sp2013demo:100" -To Claims –RetainPermissions -Force
share|improve this answer
Would it get converted to Forms Claims/Windows Claims? – variable Feb 27 '14 at 6:31
Windows claims, you need to perform extra steps to make forms based like Membership provider. see this for more info:… – Nadeem Yousuf Feb 27 '14 at 6:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.