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.


Img Src: NEW AITP

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

Get-SPWebTemplatesEnabledForSiteMaster

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

Eg. Get-SPWebTemplatesEnabledForSiteMaster

Import-SPAccessServicesDatabase

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.

Move-SPSocialComment

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.

New-SPSiteMaster

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

Remove-SPActivityItems

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

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

Remove-SPCentralAdministration

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

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

Reset-SPSites

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

Set-SPAppStoreWebServiceConfiguration

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

Set-SPDefaultProfileConfig

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 

Set-SPServer

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

    Start-SPService

    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"

    Stop-SPService

    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"

    Update-SPMicrofeedOptions

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

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

    Update-SPProfileServiceApplication

    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...!!! 😊

    Comments