SharePoint On-Premises to On-Premises migration – Important PowerShell CMDLETS / STSADM operations at one place – Part 2

Hi All,

Greetings for the day 🙂 LIFE IS BEAUTIFUL 🙂

Since nowadays working on SharePoint migration projects, lots of use of POWERSHELL CMDLETS using/learning. So sharing those.

In previous article we shared few important required POWERSHELL CMDLETS. – SharePoint On-premises to On-premises migration – Important PowerShell commands at one place – Part 1

Today sharing few more 🙂

stsadm -o provisionservice

Important CMDLET required in SharePoint Migration - executing stsadm -o provisionservice
Fig : Important CMDLET required in SharePoint Migration – executing stsadm -o provisionservice
stsadm -o provisionservice -action start -servicetype spwebservice

Get all site collections associated with respective content database

  • Scenario : We are migrating MOSS (SharePoint 20070) application SharePoint 2016
    • We are using content database attach method
    • Our MOSS web application has 10 content database attached
    • We are done with mounting 9 databases and forget one
    • We did visual upgrade to all site collections
    • Now while verifying sites we realized that we missed one DB and respective site collections from it
    • So we tested, mounted the remaining database but since we are multiple databases and huge number of site collections its difficult to find site collections remaining to verify from the respective database
  • So here, requirement is to get all the site collections from the given database
  • So, Get-SPSite command is for our help
PS C:\> $sites = Get-SPSite -ContentDatabase <"My Database Name">
PS C:\> $sites

Url
---
http://knowledgejunction.sharepoint.com/sites/site1
http://knowledgejunction.sharepoint.com/sites/site2

View the status of current user interface of Site

PS C:\> $site = Get-SPSite "http://knowledgejunction.sharepoint.com/sites/knowledgejunction/"

PS C:\> $site.GetVisualReport()

SitePath                      : /sites/knowledgejunction
WebPath                       : /sites/knowledgejunction
UIVersion                     : 15
UIVersionConfigurationEnabled : False
MasterUrl                     : /sites/knowledgejunction/_catalogs/masterpage/seattle.master
CustomMasterUrl               : /sites/knowledgejunction/_catalogs/masterpage/seattle.master

SitePath                      : /sites/knowledgejunction
WebPath                       : /sites/knowledgejunction/sharepoint
UIVersion                     : 15
UIVersionConfigurationEnabled : False
MasterUrl                     : /sites/knowledgejunction/sharepoint/_catalogs/masterpage/seattle.master
CustomMasterUrl               : /sites/knowledgejunction/sharepoint/_catalogs/masterpage/seattle.master
Important CMDLET required in SharePoint Migration - getting visual upgrade report for the respective site
Fig : Important CMDLET required in SharePoint Migration – getting visual upgrade report for the respective site

Convert users from classic mode authentication to claim based – WebApplication.MigrateUsers()

 $webApp = Get-SPWebApplication <"My Webapplication URL">
 $webApp.MigrateUsers($true)

OR

Convert-SPWebApplication -Identity "your-web-application-url" -To Claims  -RetainPermissions

Upgrade-SPContentDatabase

  • Upgrades the attached content database scema in the farm
  • Database upgrade dosent update the compability of site collections in the database
Upgrade-SPContentDatabase <Content DB>

stsadm -o enumsites

stsadm.exe -o enumsites -url <virtual server URL> -showlocks -redirectedsites

  • It returns result as follows
<Sites Count="44">
  <Site Url="http://knowledgejunction.sharepoint.com" Owner="KnowledgeJunction\prasham" SecondaryOwner="KnowledgeJunction\prasham" ContentDatabase="knowledgejunction" Lock="readonly" StorageUsedMB="1429133.1" StorageWarningMB="0" StorageMaxMB="0" />

  <Site Url="http://knowledgejunction.sharepoint.com" Owner="KnowledgeJunction\prasham" ContentDatabase="knowledgejunction" Lock="readonly" StorageUsedMB="144.1" StorageWarningMB="8000" StorageMaxMB="10240" />

  <Site Url="http://knowledgejunction.sharepoint.com" Owner="KnowledgeJunction\prasham" SecondaryOwner="KnowledgeJunction\prasham" ContentDatabase="knowledgejunction" Lock="noaccess" StorageUsedMB="24.9" StorageWarningMB="8000" StorageMaxMB="10240" />

  <Site Url="http://knowledgejunction.sharepoint.com" Owner="KnowledgeJunction\prasham" SecondaryOwner="KnowledgeJunction\prasham" ContentDatabase="knowledgejunction" Lock="none" StorageUsedMB="9870.5" StorageWarningMB="25000" StorageMaxMB="30000" />
</Sites>

Add-SPSolution

Important CMDLET for migration - Add-SPSolution
Fig : Important CMDLET for migration – Add-SPSolution

Install-SPSolution

Important CMDLET for migration - Install-SPSolution
Fig : Important CMDLET for migration – Install-SPSolution

Thanks for reading 🙂 If its worth at least reading once, kindly please like and share 🙂 SHARING IS CARING 🙂

Enjoy the beautiful life 🙂 Have a FUN 🙂 HAVE A SAFE LIFE 🙂 TAKE CARE 🙂

Prasham Sabadra

LIFE IS VERY BEAUTIFUL. ENJOY THE WHOLE JOURNEY :) Founder of Microsoft 365 Junction, Speaker, Author, Learner, Developer, Passionate Techie. Certified Professional Workshop Facilitator / Public Speaker. Believe in knowledge sharing. Around 20+ years of total IT experience and 17+ years of experience in SharePoint and Microsoft 365 services Please feel free me to contact for any SharePoint / Microsoft 365 queries. I am also very much interested in behavioral (life changing) sessions like motivational speeches, Success, Goal Setting, About Life, How to live Life etc. My book - Microsoft 365 Power Shell hand book for Administrators and Beginners and 100 Power Shell Interview Questions - https://www.amazon.in/Microsoft-Administrators-Beginners-Interview-Questions/dp/9394901639/ref=tmm_pap_swatch_0?_encoding=UTF8&qid=1679029081&sr=8-11

You may also like...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.