Saturday, 5 November 2016

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 –




View Threshold limit issue in List/Library

Today I am providing the Power Shell Script that will disable view threshold limit on a given library of the given site. This script is useful in case your list/library has more document then its view threshold limit and you are not able to see any data in the list and even no view is working as indexing can’t be done after view threshold limit is crossed. Use this script on the list then you will be able to index the columns. This option will be applied on the given list only so you will not need to change view threshold  limit to see the items in the list.

Inputs
Site url - URL of the site where your list/library exists
List name - name of the list/library where you want to disable threshol limit

Outputs
This script will disable view threshold limit on a given library of the given site.

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.

Enable Developer Dashboard

Today I am providing the Power Shell Script that will enable Developer Dashboard in your SharePoint 2013 environment.

Inputs
Database name - Database name required if we need to create a new usage application
Usage application name - Usage application name required if we need to create a new usage application

Outputs
This Script will enable Developer Dashboard in local SharePoint 2013 environment.

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.



Reset BLOB Cache

Today I am providing the Power Shell Script that will reset the BLOB Cache of the wfe server. 
Sometimes BLOB cache stop syncing with database due to this reason you will not able to recognize the changes (if any Change is made) in the file that are enabled for blob cache. In that case we have to flush the BLOB Cache. This script is needed to be run on all the wfe servers where ever the web application hosting.
Inputs
Web Application URL - URL of the web application for which you are going to reset the blob cache

Outputs
This script will reset the BLOB cache of the given web application.

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

Dependencies –
For executing this script, User who is going to flush the BLOB cache must have securityadmin and dbowner rights on SQL and database.
User should also be local administrator on the server where this script will be executed.
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.

Properly Install/Uninstall/Update Sharepoint Solution


Today I am providing the Power Shell Script that will install, uninstall or update a SharePoint solution (wsp file) in SharePoint. It will also activate/deactivate the site collection, Web app feature in SharePoint web application/Site collection.

Inputs
Path - Provide log file path to save the logs of the script.
Action - Select option to be performed - 1 for update, 2 for Install or 3 for Uninstall
webapplication url - provide web application url for installing the wsp file and activating the feature.

Outputs
Solution will be installed, uninstalled and updated on the bases of selected option.if you are selecting uninstall or update solution a backup of existing wsp will be taken from SharePoint in log file path.

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

Dependencies –
Solution and script should be saved in same folder. it will install/uninstall all the solutions.
For activating/deactivating a feature, feature name should contain the name of wsp file in its name.
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.

Find a given webpart in the given site collection


Today I am providing the Power Shell Script that is useful to find out a given web part (or all) in all the pages in all over the given site collection.

Inputs
Path - Provide log file path to save the web part report.
Sitecollection url - provide site collection url where the given web part will be searched.
Webpart name - Enter the webpart name, Name is case sensitive (Use wild card (*) if you want to match a particular string in name like you can use *bp* to get the list of all page that contains any webpart which contains bp in its name or provide * to get the list of all webparts

Outputs
A CSV file will be generated with the url of the pages where a given web part is available. or all the web parts available.

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.


Mapping User Profile Property for AD Synchronization

Today I am providing the Power Shell Script that will map the given user profile properties with given AD Synchronization properties. User will have to create a CSV file that will contain User Profile Property names and their respective Connection and Ad property and script will map them all.

Inputs
CSV path - Provide the Path of CSV file where you have save to map the user profile.

Outputs
This script will map user profile properties for Ad synchronization properties, that you have defined in CSV file. Define the mapping multiple times if you want to add mapping multiple times.

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

Dependencies –
Run this script with Farm Account. Farm account is the user who installed SharePoint.
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.
CSV file template –