SharePoint 2013 : Stsadm to Windows PowerShell mapping

Below is the list of PS equivalent commands to STSADM commands,

Stsadm operation

Windows PowerShell cmdlet

Activatefeature

Enable-SPFeature

Activateformtemplate

Enable-SPInfoPathFormTemplate

Addalternatedomain

New-SPAlternateUrl

Addcontentdb

Mount-SPContentDatabase

New-SPContentDatabase

Adddataconnectionfile

Install-SPDataConnectionFile

Add-ecsfiletrustedlocation

New-SPExcelFileLocation

Add-ecssafedataprovider

New-SPExcelDataProvider

Add-ecstrusteddataconnectionlibrary

New-SPExcelDataConnectionLibrary

Add-ecsuserdefinedfunction

New-SPExcelUserDefinedFunction

Addexemptuseragent

Add-SPInfoPathUserAgent

Addpath

New-SPManagedPath

Addpermissionpolicy

None

Addsolution

Add-SPSolution

Addtemplate

None

Adduser

New-SPUser

Addwppack

Install-SPWebPartPack

Addzoneurl

New-SPAlternateUrl

Allowuserformwebserviceproxy

Set-SPInfoPathWebServiceProxy

Use the AllowForUserForms and Identity parameters.

Allowwebserviceproxy

Set-SPInfoPathWebServiceProxy

Use the AllowWebServiceProxy and Identity parameters.

Authentication

Set-SPWebApplication

Use the AuthenticationMethod or AuthenticationProvider parameters.

Backup

Backup-SPConfigurationDatabase

Backup-SPFarm

Backup-SPSite

Backuphistory

Get-SPBackupHistory

Binddrservice

None

Blockedfilelist

None

Canceldeployment

None

Changepermissionpolicy

None

Copyappbincontent

None

Createadminvs

New-SPCentralAdministration

Creategroup

None

Createsite

New-SPSite

Createsiteinnewdb

New-SPSite Use the ContentDatabase parameter.

New-SPContentDatabase

Createweb

New-SPWeb

Databaserepair

None

Deactivatefeature

Disable-SPFeature

Deactivateformtemplate

Disable-SPInfoPathFormTemplate

Deleteadminvs

None

Deletealternatedomain

Remove-SPAlternateUrl

Deleteconfigdb

Remove-SPConfigurationDatabase

Deletecontentdb

Dismount-SPContentDatabase

Deletegroup

None

Deletepath

Remove-SPManagedPath

Deletepermissionpolicy

None

Deletesite

Remove-SPSite

Deletesolution

Remove-SPSolution

Deletetemplate

None

Deleteuser

Remove-SPUser

Deleteweb

Remove-SPWeb

Deletewppack

Uninstall-SPWebPartPack

Deletezoneurl

Remove-SPAlternateUrl

Deploysolution

Install-SPSolution

Deploywppack

Install-SPWebPartPack

Disablessc

None

Displaysolution

Get-SPSolution

Editcontentdeploymentpath

Set-SPContentDeploymentPath

Email

None

Enablessc

None

Enumalternatedomains

Get-SPAlternateURL

Enumcontentdbs

Get-SPContentDatabase

Enumdataconnectionfiledependants

Get-SPDataConnectionFileDependent

Enumdataconnectionfiles

Get-SPDataConnectionFile

Enumdeployments

None

Enumexemptuseragents

Get-SPInfoPathUserAgent

Enumformtemplates

Get-SPInfoPathFormTemplate

Enumgroups

None

Enumroles

None

Enumservices

Get-SPServiceInstance

Enumsites

Get-SPSiteAdministration (To run this cmdlet, you must be a member of the Farm Administrators group.)

Get-SPSite (To run this cmdlet, you must be a local administrator on the computer where SharePoint 2013 is installed.)

Enumsolutions

Get-SPSolution

Enumsubwebs

Get-SPWeb

Enumtemplates

Get-SPWebTemplate

Enumusers

Get-SPUser

Enumwppacks

Get-SPWebPartPack

Enumzoneurls

Get-SPAlternateURL

Execadmsvcjobs

Start-SPAdminJob

Export

Export-SPWeb

Extendvs

New-SPWebApplication

Extendvsinwebfarm

New-SPWebApplicationExtension

Forcedeletelist

None

Getadminport

Get-SPWebApplication

Use the following syntax:

  • Get-SPWebApplication -IncludeCentralAdministration | ? {$_.IsAdministrationWebApplication -eq $true}

Getdataconnectionfilepropertyproperty

Get-SPDataConnectionFile

Use the following syntax:

  • Get-SPDataConnectionFile | where {$_.Name -eq "dataConFileName"} | format-list

Getformtemplateproperty property

Get-SPInfoPathFormTemplate

Use the following syntax:

  • Get-SPInfoPathFormTemplate | where {$_.DisplayName -eq "formTemplateName"} | format-list

Getosearchsetting

None

Getproperty

Get-SPFarmConfig

Get-SPTimerJob

Disable-SPTimerJob

Enable-SPTimerJob

Set-SPTimerJob

Start-SPTimerJob

Getsitelock

Get-SPSiteAdministration

Getsiteuseraccountdirectorypath

None

Geturlzone

Get-SPAlternateURL

Import

Import-SPWeb

Installfeature

Install-SPFeature

Listlogginglevels

Get-SPLogLevel

Listqueryprocessoroptions

None

Listregisteredsecuritytrimmers

Get-SPEnterpriseSearchSecurityTrimmer

Localupgradestatus

None

Managepermissionpolicylevel

None

Mergecontentdbs

Move-SPSite

Migrateuser

Move-SPUser

Osearch

 

For the Osearch parameters farmcontactemailfarmperformancelevelfarmserviceaccount, and farmservicepassword, use theGet-SPEnterpriseSearchService and Set-SPEnterpriseSearchService cmdlets.

For the Osearch parameters start and stop, use the Start-SPEnterpriseSearchServiceInstance and Stop-SPEnterpriseSearchServiceInstance cmdlets, respectively.

For the Osearch parameter defaultindexlocation, use the Get-SPEnterpriseSearchServiceInstance cmdlet.

Osearchdiacriticsensitive

 

Use the Get-SPEnterpriseSearchServiceApplication cmdlet to retrieve the specific Search service application, and then useDiacriticSensitive parameter from the Set-SPEnterpriseSearchServiceApplication cmdlet.

Profilechangelog

None.

However, you can use the Stsadm profilechangelog operation if you replace the Shared Services Provider (SSP) name with the service application (SA) name:

 
 
stsadm -o profilechangelog
-title <SA name>
-daysofhistory <number of days>
-generateanniversaries

For more information about service applications, see About service applications and services in SharePoint 2013.

Provisionservice

Start-SPServiceInstance

Quiescefarm

None

Quiescefarmstatus

None

Quiesceformtemplate

Stop-SPInfoPathFormTemplate

Reconvertallformtemplates

Update-SPInfoPathFormTemplate

Refreshdms

None

Refreshsitedms

None

Registersecuritytrimmer

New-SPEnterpriseSearchSecurityTrimmer

Registerwsswriter

None

Removedataconnectionfile

Uninstall-SPDataConnectionFile

Remove-ecsfiletrustedlocation

Remove-SPExcelFileLocation

Remove-ecssafedataprovider

Remove-SPExcelDataProvider

Remove-ecstrusteddataconnectionlibrary

Remove-SPExcelDataConnectionLibrary

Remove-ecsuserdefinedfunction

Remove-SPExcelFileLocation

Removedrservice

None

Removeexemptuseragent

Remove-SPInfoPathUserAgent

Removeformtemplate

Uninstall-SPInfoPathFormTemplate

Removesolutiondeploymentlock

None

Renameserver

Rename-SPServer

Renamesite

Set-SPSite

Use the Url parameter.

Renameweb

Set-SPWeb

Use the RelativeUrl parameter.

Restore

Restore-SPFarm

Restore-SPSite

Retractsolution

Uninstall-SPSolution

Retractwppack

None

Runcontentdeploymentjob

 

 

Start-SPContentDeploymentJob

Scanforfeatures

Install-SPFeature

Use the Scanforfeatures parameter.

Setadminport

Set-SPCentralAdministration

Setapppassword

None

Setconfigdb

Connect-SPConfigurationDatabase

Setcontentdeploymentjobschedule

Set-SPContentDeploymentJob

Setdataconnectionfileproperty

Set-SPDataConnectionFile

Set-ecsexternaldata

Set-SPExcelFileLocation

Set-ecsloadbalancing

Set-SPExcelServiceApplication

Use the LoadBalancingScheme parameter.

Set-ecsmemoryutilization

Set-SPExcelServiceApplication

Use the MemoryCacheThreshold and PrivateBytesMax parameters.

Set-ecssecurity

Set-SPExcelServiceApplication

Use the CrossDomainAccessAllowedEncryptedUserConnectionRequired, and FileAccessMethod parameters.

Set-ecssessionmanagement

Set-SPExcelServiceApplication

Use the SessionsPerUserMax and SiteCollectionAnonymousSessionsMax parameters.

Set-ecsworkbookcache

Set-SPExcelServiceApplication

Use the Workbookcache and WorkbookCacheSizeMax parameters.

Setformtemplateproperty

Set-SPInfoPathFormTemplate

Setlogginglevel

Set-SPLogLevel

Setosearchsetting

None

Setproperty

Set-SPFarmConfig

Get-SPTimerJob

Disable-SPTimerJob

Enable-SPTimerJob

Set-SPTimerJob

Start-SPTimerJob

Setqueryprocessoroptions

None

Setsitelock

Set-SPSiteAdministration

Use the LockState parameter.

Setsiteuseraccountdirectorypath

Get-SPSiteSubscription

New-SPSiteSubscription

Remove-SPSiteSubscription

Setworkflowconfig

Set-SPWorkflowConfig

Siteowner

Set-SPSiteAdministration

Syncsolution

Install-SPSolution

Use the Synchronize parameter.

Unextendvs

Remove-SPWebApplication

Uninstallfeature

Uninstall-SPFeature

Unquiescefarm

None

Unquiesceformtemplate

Start-SPInfoPathFormTemplate

Unregistersecuritytrimmer

Remove-SPEnterpriseSearchSecurityTrimmer

Unregisterwsswriter

None

Updateaccountpassword

Set-SPManagedAccount

Updatealerttemplates

None

Updatefarmcredentials

None

Upgrade

None

Upgradeformtemplate

Install-SPInfoPathFormTemplate

Upgradesolution

Update-SPSolution

Upgradetargetwebapplication

None

Uploadformtemplate

Install-SPInfoPathFormTemplate

Userrole

Get-SPUser

Move-SPUser

New-SPUser

Remove-SPUser

Set-SPUser

Verifyformtemplate

Test-SPInfoPathFormTemplate

How to: Create a Master Page in SharePoint 2013 using Visual Studio

Step I: Create Master Page Design Manager using
To create a minimal master page
  1. Browse to your publishing site.
  2. In the upper-right corner of the page, choose Settings, and then choose Design Manager.
  3. In Design Manager, in the left navigation pane, choose Edit Master Pages.
  4. Choose Create a minimal master page.
  5. In the Create a Master Page dialog box, enter a name for the master page, and then choose OK.At this point, SharePoint creates both a .master file and an associated HTML file with the same name in the Master Page Gallery.In Design Manager, your HTML file now appears with Conversion successful displayed in the Status column.
  6. Follow the link in the Status column to preview the file.The preview page is a live server-side preview of your master page.For more information about previewing the master page with different pages, see How to: Change the preview page in SharePoint 2013 Design Manager.The preview page also contains a Snippets link in the upper-right corner. This link opens the Snippet Gallery, where you can begin replacing static or mock-up controls in your design with dynamic SharePoint controls. For more information, see SharePoint 2013 Design Manager snippets.After your master page previews successfully, you will see a <div> tag that gets added to your HTML file. You may have to scroll to the bottom of the page to see the <div> tag.This <div> is the main content block. It resides inside a content placeholder named ContentPlaceHolderMain. At run time, when a visitor browses your site and requests a page, this content placeholder gets filled with content from a page layout that contains content in a matching content region. You should position this <div> where you want your page layouts to appear on the master page.
  7. You can edit the HTML file that resides directly on the server by using an HTML editor to open and edit the HTML file in a mapped drive. Each time you save the HTML file, any changes are synced to the associated .master file. For more information, see How to: Map a network drive to the SharePoint 2013 Master Page Gallery.
Step II : Download the MasterPage and HTML
  1. Go to MasterPage Gallary
  2. Find your created Master Page and HTML File and “Download A Copy” the same by clicking on the right side … button
  3. Keep the Downloaded files to specific location
Step III : Integrate the created master page in Step I to Visual Studio Project
  1. Create the module as depicted in below fig,
  2. 1
  3. Add the Step II copied .MasterPage and .HTML to Module
  4. Edit the the Element.xml as below,
  5. 2
  6. Create a publishing feature and add the the module to it 3
  7. Deploy the Feature and activate the same
  8. Now Master Page should reflect to master page gallery of deployed site

Load Balancing Service Applications on multiple application Server for SharePoint 2010 and 2013

How does it work?

A Service Application Proxy typically requests an endpoint for a connected Service Application from the load balancer, which is a software component that executes in the same process and application domain as the proxy.

The load balancer maintains a complete list of available endpoints for each Service Application in a cache, and simply returns the next available endpoint to the proxy in a round-robin fashion.

How does it maintain the list of available service application endpoints?

For communication with service applications that are local to a SharePoint server farm, the load balancer looks into the configuration database to discover the available endpoints for a service application.

In this case, the endpoint cache is updated whenever the list of available service application endpoints in the local configuration database changes. The delay in updating the cache is typically less than 1 minute.

For communication with service applications in a remote server farm (i.e., federated services), the load balancer uses the Topology web service (aka, “Application Discovery and Load Balancer Service”) to discover the available endpoints for a service application.

In this case, the list of service application endpoints is periodically retrieved from the Topology web service on the remote farm and copied into the local configuration database as an intermediate cache.

This periodic retrieval is performed by the “Application Addresses Refresh” timer job. By default, this timer job executes every 15 minutes.

How does it handle failures?

The Service Application Proxy may report an endpoint failure to the load balancer, in which case the load balancer will remove the specified endpoint from the round-robin rotation for some period of time.

By default, this period is 10 minutes (configurable using the “BadListPeriod” parameter of the Set-SPTopologyServiceApplicationProxy Cmdlet).

If only one endpoint remains, it will not be removed from the rotation, even if a proxy reports a failure for that endpoint.

Is the Topology Web service a single point of failure for the load balancer?

No. The Topology web service application proxy is “self-balancing”. In other words, it uses the same round-robin load balancing algorithm to provide fault tolerance for itself.

When an administrator creates a connection to a remote (federated) service application, the connection information includes one of the Topology web service application endpoints (selected at random) from the remote server farm. I’ll call this the “bootstrap” node.

The bootstrap node is used to query the complete list of Topology web service application endpoints, which are then cached in the local SharePoint configuration database and used to round-robin all future requests to the Topology web service application.

This cached list of Topology web service application endpoints is then updated periodically just like any other federated service application.

So, the bootstrap node is only needed one time when an administrator creates a new connection (Service Application Proxy) to a remote service application.

What are the limitations of the load balancer?

There is an extreme case where connectivity to a federated service farm may be lost by replacing all of the servers in the remote farm within a single cache refresh interval (i.e., before the “Application Addresses Refresh” timer job can execute).

To hit this case, you would need to bring down all of the servers hosting the Topology web service application in the service farm at once, and after they are all down, replace them all with servers that have different addresses, essentially moving the entire farm to a new set of servers at once rather than gradually over time.

In this case, none of the Topology web services endpoints cached by the client farm would be valid, and the client could would not be able to acquire the all-new list of endpoints (because it needs at least one valid endpoint to query the list of new endpoints).

To avoid this situation, at least one of the Topology web servers in the service farm should be maintained long enough for client farms to update their cache with at least one of the new Topology web service endpoints (at which point the old server can safely be removed). Alternatively, give at least one of the new servers the same name as one of the servers being replaced.

Another limitation of the Service Application load balancer is that the list of available endpoints is maintained separately in the application domain of each caller, and there is no coordination between callers.

This means that each proxy must independently discover that an endpoint is unavailable for some reason, which may translate to one failure per caller application domain (e.g., client application pool process) when a given server goes down unexpectedly.

This also means that it is theoretically possible that some clients may achieve lock-step and send requests to the same servers in succession, thus achieving fault tolerance but not the most effective load balancing.

SharePoint 2010: Updating MasterPages and Page Layouts – using Feature

I was facing issue while trying to deploying the custom Page layout. Below feature code giving issue while activation,

<Module Name="MasterPageModule" Url ="_catalogs/masterpage" List="116">
 <File Path="MasterPageModule\defaultTemplate.aspx" Url="defaultTemplate.aspx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="FALSE">
  <Property Name="Title" Value="My Custom Page Layout" />
  <Property Name="ContentType" Value="$Resources:cmscore,contenttype_pagelayout_name;" />
  <Property Name="ContentType" Value="$Resources:cmscore,contenttype_pagelayout_name;" />
  <Property Name="PublishingPreviewImage" Value="~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview Images/ArticleLinks.png, ~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview Images/ArticleLinks.png" />
  <Property Name="PublishingAssociatedContentType" Value=";#Welcome Page;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF390064DEA0F50FC8C147B0B6EA0636C4A7D4;#" />
 </File>

Problem statement : This give below issue,

Error occurred in deployment step ‘Activate Features’: A file specified in the modules section of this template already exists.

When I set IgnoreIfAlreadyExists=”TRUE” layout is not updated. And also I can’t delete this layout by Sharepoint Designer because “This item cannot be delete because it is still referenced by other pages”. Yes, it’s definitely referenced by some pages but in development i need to update it many times.

Solution to given Problem:

IgnoreIfAlreadyExists attribute within Module element can be tricky because sometimes it doesn’t work to update the MasterPages and Page Layouts properly. The following code can be helpful in performing updates upon Feature Activation.
 using System;
using System.Collections.Generic;
using System.Xml.Linq;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using System.Globalization;
using System.Xml;
using System.Collections;
using System.Linq;
using System.IO;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using Microsoft.SharePoint.Security;
namespace TestSPSolution
{
     public class UpdatePagesFeatureReceiver : SPFeatureReceiver
{
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
if (properties != null)
{
using (SPSite currentSite = (SPSite)properties.Feature.Parent)
{
using (var web = currentSite.OpenWeb())
{
var ElementDefinitions = properties.Definition.GetElementDefinitions(CultureInfo.CurrentCulture);                        foreach (SPElementDefinition ElementDefinition in ElementDefinitions)
{
if (ElementDefinition.ElementType == “Module”)
{
Helper.UpdateFilesInModule(ElementDefinition, web);
}
}
}}
}
}public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
{
//// throw new NotImplementedException();
}

public override void FeatureInstalled(SPFeatureReceiverProperties properties)
{
////throw new NotImplementedException();
}

public override void FeatureUninstalling(SPFeatureReceiverProperties properties)
{
//// throw new NotImplementedException();
}
}

internal static class Helper
{
internal static void UpdateFilesInModule(SPElementDefinition elementDefinition, SPWeb web)
{
XElement xml = elementDefinition.XmlDefinition.ToXElement();
XNamespace xmlns = “http://schemas.microsoft.com/sharepoint/&#8221;;
string featureDir = elementDefinition.FeatureDefinition.RootDirectory;
Module module = (from m in xml.DescendantsAndSelf()
select new Module
{
ProvisioningUrl = m.Attribute(“Url”).Value,
PhysicalPath = featureDir,
Files = (from f in m.Elements(xmlns.GetName(“File”))
select new Module.File
{

FilePath = (m.Attribute(“Path”) == null) ? string.Empty : Path.Combine(featureDir, m.Attribute(“Path”).Value),
Name = f.Attribute(“Url”).Value,
Properties = (from p in f.Elements(xmlns.GetName(“Property”))
select p).ToDictionary(
n => n.Attribute(“Name”).Value,
v => v.Attribute(“Value”).Value)
}).ToArray()
}).First();

if (module == null)
{
return;
}

foreach (Module.File file in module.Files)
{

string physicalPath = string.IsNullOrEmpty(file.FilePath) ? Path.Combine(module.PhysicalPath, file.Name) : Path.Combine(file.FilePath, file.Name);
string virtualPath = string.Concat(web.Url, “/”, module.ProvisioningUrl, “/”, file.Name);

if (File.Exists(physicalPath))
{
using (StreamReader sreader = new StreamReader(physicalPath))
{
if (!CheckOutStatus(web.GetFile(virtualPath)))
{
web.GetFile(virtualPath).CheckOut();
}
SPFile spFile = web.Files.Add(virtualPath, sreader.BaseStream, new Hashtable(file.Properties), true);
spFile.CheckIn(“Updated”, SPCheckinType.MajorCheckIn);
if (CheckContentApproval(spFile.Item))
{
spFile.Approve(“Updated”);
}

spFile.Update();
}
}
}

}

private static bool CheckOutStatus(SPFile file)
{
if (file.CheckOutStatus != SPFile.SPCheckOutStatus.None)
{
return true;
}
else
{
return false;
}
}

private static bool CheckContentApproval(SPListItem listitem)
{
bool isContentApprovalEnabled = listitem.ParentList.EnableModeration;

return isContentApprovalEnabled;
}

public static XElement ToXElement(this XmlNode node)
{
XDocument xDoc = new XDocument();

using (XmlWriter xmlWriter = xDoc.CreateWriter())

node.WriteTo(xmlWriter);

return xDoc.Root;

}
}

public class Module
{
public string ProvisioningUrl { get; set; }
public string PhysicalPath { get; set; }
public Module.File[] Files { get; set; }

public class File
{
public string FilePath { get; set; }
public string Name { get; set; }
public Dictionary Properties { get; set; }
}
}
}

SharePoint 2013 – Limits of Web Application, Site Collection level, List, Document library and Security objects

During the design or Architecture of SharePoint 2013 based application, we need to consider various limitations.Few of them I tried to capture in this document,

 

1. Content DB Level Limits
Sr. No. Functionality Limits
1 content databases per farm 500
2 The content database size 200 GB
3 Items including list and document items inside content databases 60 million
4 Site collections can be possible per content database 10,000
5 Non-Personal site collections 2500
6 Personal Sites – site collection 7500 or 10000(alone)
7 The time to first byte of any response from the Network Attached Storage (NAS) 20 milliseconds

 

2. Web Application Level
Sr. No. Functionality Limits
1 Web applications possible per SharePoint farm 20
2 Zones per web application and these are Default, Intranet, Extranet, Internet, and custom. 5
3 Managed paths for host-named site collections per farm 20
4 Managed paths for path-based site collections per web application 20
5 Solution cache size per web application 300 MB
6 Application pools per web server 10

 

3. Site Collection Level Limits
Sr. No. Functionality Limits
1 Site collections per farm 750,000 (500,000 Personal Sites and 250,000 other sites per farm)
2 Web site are supported per site collection 2,50,000
3 The maximum allowed number of device channels per publishing site collection 10

 

4. List or Document Library Limits
Sr. No. Functionality Limits
1 List or library row size 8000 bytes per row
2 The default maximum file size 250 MB
(can be configure it up to 2 GB but as the size increases it will give some performance issue)
3 Documents stored per document librar 3,00,00,000
4 major versions supported for a file 4,00,000
5 The maximum number of minor file versions 511
6 items per list 3,00,00,000
7 The user interface allows a maximum items 100
8 join operations per query 8
9 The list threshold limit 5000
10 List view threshold for auditors and administrators 20000
11 sub site per site view 2000
12 concurrent editors per document for coauthoring in word or PowerPoint files. 10
13 The maximum number of unique security scopes set for a list 50

 

5. Security Level Limits
Sr. No. Functionality Limits
1 A user can belongs to maximum SharePoint groups 5000
2 Users per site collection 2 million
3 Users to a SharePoint group 5000
4 Groups per site collection 10000