Creating new SharePoint website using Windows PowerShell

  • Start your windows PowerShell on your computer.
  • Right click and select Run as administrator option.
  • Paste the below script on the PowerShell window and click the enter button.
  • Check your SharePoint site Feature will activated successfully.
  1. $context = Connect-SPOSite https://gauti.sharepoint.com    
  2.      
  3. $creation = New-Object Microsoft.SharePoint.Client.WebCreationInformation    
  4. $creation.Url = "TestWeb"    
  5. $creation.Title = "TestWebName"    
  6. $newWeb = context.Web.Webs.Add($creation)    
  7.    
  8. # Retrieve the new web information.    
  9. Load-CSOMProperties -object $newWeb -propertyNames @("Title")    
  10. $context.ExecuteQuery()    
Run the script with the required administrator privilege.To verify that, Check the output window. Thanks for reading my blog.
 
Hope you have enjoyed this.