Skip to main content

Powershell Commands in SP2016 Part-II

Some cmdlets of SP2016 I described in my previous post Powershell Commands In SP2016 Part-I. I will describe some more cmdlets in this post.


So lets get started and have a glimpse at remaining ones of new cmdlets:


Use this cmdlet to get the full list of all the site master web templates in the farm.

Eg. Get-SPWebTemplatesEnabledForSiteMaster


This cmdlet imports the service database from the bacpac package as exported by the cmdlet
Export-SPAccessServicesDatabase (explained in my previous post). A Bacpac file is created by SQL Server during an export operation of a database. It contains all the information needed for moving or importing the database to a new SQL Server. 

Eg.  Import-SPAccessServicesDatabase -Bacpac AccessApp.bacpac -DatabaseName $db -ServerReferenceId $id

Here, Bacpac, Databasename and ServerReferenceId are the required parameters.


This cmdlet moves the social comment from one page to another page.

Eg. $upaProxy = Get-SPServiceApplicationProxy 1232b6f7-b9ff-99ad-0cd0-fg1g67h981aq
Move-SPSocialComments -ProfileServiceApplicationProxy $upaProxy -OldUrl "http://site/Pages/oldtest.aspx" -NewUrl "http://site/Pages/newtest.aspx"

Note: This cmdlet does not move tags or ratings.


This cmdlet creates a site master information in the farm. These are the new kind of web templates/site definitions that live within the content databases.

Eg. New-SPSiteMaster -ContentDatabase WSS_Content -Template STS#0


This cmdlet removes the activity events from the published and consolidated tables. 

Eg. $upaProxy = Get-SPServiceApplicationProxy 1232b6f7-b9ff-99ad-0cd0-fg1g67h981aq
Remove-SPActivityItems $upaProxy


This cmdlet removes the SharePoint Central Administration website from the local server.

Eg. Remove-SPSiteMaster -ContentDatabase "WSS_Content" -SiteId "<Guid of site>"


This cmdlet synchronizes the content database with the configuration database of the farm with respect to what site collections actually exist in the content database.

It also ensures that all site collections in the content database are registered in the configuration database and removes any site collection references in the configuration database if the site collection does not exist in the content database.

Eg. Reset-SPSites -Identity WSS_Content


This cmdlet sets properties of a SharePoint Store app.

Use the cmdlet to set the product type (On-Premises or Online) and the version used to access the SharePoint Store when SharePoint is configured to access the .

Note: This cmdlet is not intended for the ITPro audience.

Eg. Set-SPAppStoreWebServiceConfiguration -Client=SP -ProxyVersion=16.1


This cmdlet changes the MySitesPublicEnabled property of the User Profile Application Proxy from whatever was set at the time of Proxy creation to whatever is defined by using this cmdlet.

Eg.$upaProxy = Get-SPServiceApplicationProxy 1232b6f7-b9ff-99ad-0cd0-fg1g67h981aq
Set-SPDefaultProfileConfig $upa -MySitesPublicEnabled $true 


This cmdlet changes the role of the server in the farm by using the Role parameter.

So similar to the installer you can now set the SharePoint role  to any of the following options:
  • Invalid
  • WebFrontEnd 
  • Application
  • SingleServer
  • SingleServerFarm
  • DistributedCache
  • Search
  • Custom

     Eg.Set-SPServer -Role SingleServerFarm


    This cmdlet enables the service in the farm. Service instances for this service will be started on the appropriate servers in the farm.

    Eg. Start-SPService -Identity "Microsoft SharePoint Foundation Sandboxed Code Service"


    This cmdlet disables a service in the farm. Service instances for this service will be stopped on the appropriate servers in the farm.

    Eg. Stop-SPService -Identity "Microsoft SharePoint Foundation Sandboxed Code Service"


    This cmdlet updates the feed cache settings for the current user profile application.

    Eg.Update-SPMicrofeedOptions -ProfileServiceApplicationProxy c6681d53-e6c4-432f-9f31-22d3de81b00c


    This cmdlet upgrades User Profile Service and its related profile and social store.

    Eg. $upa = Get-SPServiceApplication | ? {$_.TypeName -like '*User Profile*'}
    Upgrade-SPProfileServiceApplication $upa

    That's all for the cmdlets of SP2016.

    Happy Learning Powershell...!!! 😊