Monday, 28 January 2013

Sign in as a different user in share point 2013

Sign in as a different user in share point 2013


Open welcome.ascx  from \15\TEMPLATE\CONTROLTEMPLATES\Welcome.ascx

Add following code there.

<SharePoint:MenuItemTemplate runat="server" ID="ID_LoginAsDifferentUser"

Save and trying to browse the site again.

Here you can see.......

*Please note it will impact whole farm, so if you need this for every where then only go with this one.


Saturday, 26 January 2013

SharePoint 2013: This SQL Server instance does not have the required "max degree of parallelism" setting of 1

SharePoint 2013: This SQL Server instance does not have the required "max degree of parallelism"  setting of 1

At the Time of Configuration wizard or by power-shell you can get following error, If you are configuring least account permission.


New-SPConfigurationDatabase : This SQL Server instance does not have the required "max degree of parallelism"
setting of 1. Database provisioning operations will continue to fail if "max degree of parallelism" is not set 1....

What is Parallelism and what is the Role?

This option sets the maximum number of processors SQL Server can use for one query. If SQL Server has to bring back a lot of data (lots of rows) for a query it sometimes makes sense to break the query down into a number of smaller queries, each query returning a subset of the total rows. This way SQL Server can make use of more than processor and hence on multi processor boxes it can potentially return a lot of rows more quickly, for a given query, than it can on a single processor box.

Reason of the error:

The default setting for this in SQL is 0 and FOr SharePoint 2010 its doesnt need to change.

But In SharePoint 2013 you need to do change it to 1 . Then only you can create config database and installation will complete.


1. Login to SQL Server by using Management Studio.

2. Right click on the SQL Service Instance and select Properties

3  Under Advanced, locate Max Degree of Parallelism under the Parallelism section and switch the settings from 0 to 1.

4. CLick Ok and re run the wizard.

Please note at the time of getting error the config DB will create, So once you are going to run the wizard /powershell after fixing the Parallelism issue dont forget to delete old config DB which were created at the time of error. Other wise you will get the error.

You can say some time you dont get error this, it happens because from which account you running the wizard if that is having sys admin rights on SQL server then at time of configuration it automatically change the settings and switch to 1 , but once you follow proper permission level of accounts then you will get this error.

Friday, 25 January 2013

STSADM COMMANDS in SharePoint 2013.


If you want to RUN stsadm.exe commands in SharePoint 2013.

You can do by following ways:

By command prompt/powershell redirect to 15 Hive folder :

PS C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\BIN>


add  following module:

Add-PSSnapin Microsoft.SharePoint.Powershell -EA 0

And Start using stsadm command :):):)

Gyan Shukla

Wednesday, 23 January 2013

SharePoint 2010/2013 Multi-Tenancy: Delete an existing tenant and create a new tenant and assigned same OU

Delete an existing tenant and create a new tenant and assign same OU:

Delete tenant means delete subscription ID from farm. In share Point 2010 Every Tenant is having its own unique subscription ID.

Its quite difficult to remove connection between Subscription ID and OU.On this I did some R&D and found that if you remove subscription ID from farm all connection to OU will not deleted means some entries still present in related DBs. So until you remove all the entries from share Point DBs you cant use same OU for different tenant/subscription ID. Microsoft never advise to make changes in DB directly, but I did that and it was successful. If you don't want to get this process I have a new trick to do this.

*Don't delete Subscription ID

*Just delete all the site collection present in this.

* Assign this subscription ID to new tenant.

In this way You can easily assign subscription ID to new teanant with same OU connection.

Scripts are as below:

// This will give you all subscription ID
$sub = get-spsitesubscription

//Dont use this command:

remove-spsitesubscription -identity "$sub"

//Delete all the site collection manually from centraladmin or use powershell command related to subscription ID

Try the folowing ps script to create new Tenant and can use original ( previous) OU:

Add-PSSnapin Microsoft.SharePoint.Powershell -EA 0

//Note down your scubscription ID which you want to use and we will use later in the script.

Add-PSSnapin Microsoft.SharePoint.Powershell -EA 0

# farm details - update to reflect environment
$customerName = "<OU Name>"
$customerTenantAdmin = "<OU Admin with domain>"   
$ouName= "<OU Name>"
$fullOUPath = 'OU=<OU PATH>,OU=<OU PATH>,DC=<Domain Name>,DC=<Domain Name>'
$fullTenantURL = "http://<testsiteurl>"
$customerFeatures = $customfeature
$hostingMainURL = "http://<HostingWebApplicationURL>"
$upaProxyName = "<User Profile Proxy> Farm Tenant User Profile Service Proxy"
$mmsProxyName = "<User MetaData Proxy> Farm Tenant Managed Metadata Service Proxy"

# feature packs - update after creating them
$foundationFeatures = "479a3211-b2c8-4efd-b09e-a11194c8ef79"
$standardFeatures = "400e72d3-7a97-4e28-8a9a-ac0f6ffba4e6"
$enterpriseFeatures = "0da79437-5735-4550-b4b1-2f9608ecb328"
$a = Read-Host "Have you added the user running this script to *permissions* on the UPA?"
    $webApp = Get-SPWebApplication $hostingMainURL
    # create new Site Subscription
    Write-Host "Creating Site Subcription..."
    //$sub = New-SPSiteSubscription
$sub = "<use the existing old Subscription ID here>"

    # assign feature pack and configure the OU to use in the People Picker for the Subscription
    Write-Host "Assiging Feature Pack and configuring People Picker..."
    Set-SPSiteSubscriptionConfig –id $sub -FeaturePack $enterpriseFeatures -UserAccountDirectoryPath $fullOUPath

function ProvisionTenant($enterpriseFeatures,$customerName, $customerTenantAdmin, $customerFeatures, $hostingMainURL, $upaProxyName, $mmsProxyName, $foundationFeatures, $ouName, $fullTenantURL, $fullOUPath, $webApp, $sub)
    Write-Host "Provisioning Tenant..."
    Write-Host "Name: $customerName"
    Write-Host "Admin: $customerTenantAdmin"

    $a = Read-Host "Are Details ok ?"

    # grab the web app

    # create the "main" member site (we need a site at the root to use Host Headers and Managed Paths in the following cmdlets)
    Write-Host "Creating Root Site..."
    New-SPSite -url "$fullTenantURL" -SiteSubscription $sub -HostHeaderWebApplication $webApp -owneralias $customerTenantAdmin -template BLANKINTERNETCONTAINER#0

    # create Tenant Admin site
    Write-Host "Creating Tenant Admin site..."
    New-SPSite -url "$fullTenantURL/admin" -SiteSubscription $sub -HostHeaderWebApplication $webApp -owneralias $customerTenantAdmin -template tenantadmin#0 -AdministrationSiteType TenantAdministration

    # everything else needs standard
    if (!($customerFeatures -eq $foundationFeatures))
        Write-Host "Tenant has SharePoint Server features"
        # create a mysite host
        Write-Host "Creating My Site Host..."
        New-SPSite -url "$fullTenantURL/mysites" -SiteSubscription $sub -HostHeaderWebApplication $webApp -owneralias $customerTenantAdmin -template SPSMSITEHOST#0

        # configure the MySites host, MySites path, Naming Resolution and Profile Sync OU for the Subscription
        Write-Host "Configuring Tenant Profile Config..."
        $upaProxy = Get-SPServiceApplicationProxy | where-object {$_.DisplayName -eq $upaProxyName}
        SET-SPSiteSubscriptionProfileConfig -id $sub -SynchronizationOU $ouName -MySiteHostLocation "$fullTenantURL/mysites" -MySiteManagedPath "/mysites/personal" -SiteNamingConflictResolution "None" -ProfileServiceApplicationProxy $upaProxy

        # create a site for the Content Type Gallery
        Write-Host "Creating Content Type Gallery..."
        New-SPSite -url "$fullTenantURL/cthub" -SiteSubscription $sub -HostHeaderWebApplication $webApp -owneralias $customerTenantAdmin -template sts#0

        # configure the Content Type Gallery for the Subscription
        Write-Host "Configuring Tenant Content Type Gallery..."
        $mmsProxy = Get-SPServiceApplicationProxy | where-object {$_.DisplayName -eq $mmsProxyName}
        # ContentTypeHub feature activation may fail - if so activate manually
        Set-SPSiteSubscriptionMetadataConfig -identity $sub -serviceProxy $mmsProxy -huburi "$fullTenantURL/cthub" -SyndicationErrorReportEnabled
        Write-Host "Activating Content Type Hub..."
        Enable-SPFeature -Identity ContentTypeHub -url "$fullTenantURL/cthub"

    #Set-SPSiteSubscriptionEdiscoveryHub - create an ediscovery hub, requires site - -SearchScope 1 - all of the sub
    Write-Host "Tenant Provisioned!"
    return $sub


*You require SharePoint 2010 SP1 because SET-Sitesubscription powershell command run only SharePoint 2010 SP1 and later version.  

You can also use same concept for SharePoint 2013 :)  it works with that too...

Sunday, 20 January 2013

Anonymous Access issue for form Pages in SharePoint.


 Problem: After setting Anonymous access on entire site, why form pages (like custom views etc) still needs credentials to access them?


Default behavior of anonymous setting, once we enable anonymous access to site level anonymous permission mask sets on entire site. Under this mask only following permission properties covers.

ViewListItems, ViewVersions, Open, ViewPages, UseClientIntegration

Here you can see there is no permission properties related to form pages (views). So I have set the properties by PowerShell commands.

 New property requires to solve the issue :
ViewListItems, ViewVersions, ViewFormPages, Open, ViewPages, UseClientIntegration 


$web = Get-SPWeb
ViewListItems, ViewVersions, Open, ViewPages, UseClientIntegration
$web.AnonymousState = [Microsoft.SharePoint.SPWeb+WebAnonymousState]::Enabled
$web.AnonymousPermMask64 = "ViewListItems, ViewVersions, ViewFormPages, Open, ViewPages, UseClientIntegration"

Gyan Shukla