Showing posts with label Site Collections. Show all posts
Showing posts with label Site Collections. Show all posts

Saturday, 5 November 2016

Creating a Site Collection using script

Today I am providing the Power Shell Script that create a Site collection “host named” or normal on the given web application on the given database.

Inputs
Site collection URL : Provide the new site collection URL.
HostHeader Web Application (Optional): Provide the webapplication URL that will host this collection(in case of Hosted Site Collection). This is optional field and can be left blank if you have provided the webapplication URl in the Site collection.
Database Name (Optional): Provide Database name where you want to move above site collection. Database must already exists in web application. This is optional field.
Site name : Provide Site Collection Name
Description (Optional) : Provide Site Collection Description
Site template : Provide Site template that will be used to create the site
Primary Login : Primary user name (Primary Site Collection Administrator)
Site Primary email (Optional) : Primary administrator email if any.
Secondary Login (Optional) : Secondary user name (Secondary Site Collection Administrator)
Secondary email (Optional) : Secondary administrator email if any.

Outputs
This script will Create a new site collection on the given database on the given web application.

Example-
.\scriptname.ps1
.\scriptname.ps1 | out-file “FilePath\Filename.txt”

Dependencies –
if you are creating a site collection on specific Database then database must exists in the given webapplication.
if you are creating hosted site collection then you have to follow additional steps from this url. http://hostnamedsc.blogspot.in/2016/05/host-named-site-collection-is-not.html
For executing this script user must be added in site collection administrators given site.
User should have Shell Admin rights to run the scripts.
Run Management Shell as an Administrator.
How to execute -
Copy this script and paste in Note pad.
Save this file as .ps1.
Run this script in SharePoint Management Shell. You can run this script in PowerShell as well.
Follow on screen instructions.

FOR ANY HELP ON THIS SCRIPT USE "GET-HELP .\SCRIPTNAME.PS1 --FULL" AFTER SAVING THIS FILE.
Go to above link to get the script.



Delete Site/site collections in bulk

Today I am providing the Power Shell Script that will delete multiple sites/site collections from the given list. List will be provided in the form of a csv file. The columns in csv file will be siteurl, type. Here in type, Provide s if given url is for sub site or sc for site collection.

.Inputs
Path - Provide csv file with path that will be used as input for this script.

.Outputs
Sites will be deleted as per the list in csv file.

Example-
.\scriptname.ps1
.\scriptname.ps1 | out-file “FilePath\Filename.txt”

Dependencies –
For executing this script user must be added in site collection administrators in the sites.
User should have Shell Admin rights to run the scripts.
Run Management Shell as an Administrator.
How to execute -
Copy this script and paste in Note pad.
Save this file as .ps1.
Run this script in SharePoint Management Shell. You can run this script in PowerShell as well.
Follow on screen instructions.

FOR ANY HELP ON THIS SCRIPT USE "GET-HELP .\SCRIPTNAME.PS1 --FULL" AFTER SAVING THIS FILE.


Go to above link to get the script.
Csv template link –




Thursday, 7 April 2016

Power Shell Scripts

In This blog you will found use full Power Shell Scripts

  1. Using Task Scheduler to automate PowerShell Scripts
  2. Safely Install/Uninstall/Update a SharePoint Solution
  3. Get List of all SharePoint's Web Applications, Site Collections, Sub sites, List/Library
  4. Download All items from SharePoint in Local Farm
  5. Download Content using filter on given Column in Given site and list
  6. Get the list of All Users and Groups of a given site
  7. Get the list of All Users and Groups of Local Farm
  8. Download All solutions (wsp files) in SharePoint
  9. Set Lock State in a Site Collection (Site is in Read Only Mode Solved)
  10. Enable/Disable Save Site as Template Option
  11. Enable/Disable Delete and Save List/Library as template option
  12. Create List/Library
  13. Clear Cache of all severs in one go
  14. Granting permissions to users and groups on item level
  15. Creating a normal or host named Site Collection on given database
  16. Creating a new Content database on a given web application
  17. Modify the Site url of content type hub in Managed Metadata service application
  18. Delete Site/Site collection in bulk using a csv file
  19. View Threshold limit issue in List/Library
  20. Enable Developer Dashboard
  21. Reset BLOB Cache 
  22. Find a given webpart in the given site collection
  23. Map User profile property for Ad Synchronization