Objective
This purpose of this document is to get custom feature status (Activated/Deactivated) from selected sets of site collection configured in XML file using
PowerShell script. The reusable script for this job has also attached with this document. This script offers,
- To read a set of site collections, from which you want to get the feature status.
- Generate a report in excel format which will provide all the site details and feature status info.
Business Case
S. No. | Business Case |
1 | For several reasons we SharePoint Developer/administrators want to check if the features are activated for site collections or not. Consider a case where after the deployment administrator want to check if this feature is been activated on site collection (say 10 site collection), manually going to every managefeatures.aspx page for site and web level is not feasible. Doing like this one by one is a painful job for administrator/developer. This script will allow administrator/developers to do the job just by configuring the XML file. |
Targeted Audience
- SharePoint Application Developers
- SharePoint Administrator
- SharePoint Architect
Offerings
- One reusable PowerShell script is provided which needs to be run to get the feature status for selected set of site collections.
- Format of XML file is provided where site collection needs to be configured.
Technical Details
Below are the technical details for this PowerShell script,
1: Pre-requisites
- Login to server with Farm administrator account and copy the folder and paste the same to the location where you want to keep it.
- Open the folder and Configure XML file as per your requirement.
- <?xml version="1.0" encoding="utf-8" ?>
- <Configuration Environment="DEV" Version="1.0.0.0">
- <GlobalWebApplications>
- <GlobalWebApplication url="http://mywebapplicationURL">
- <CustomFeatures>
- <SiteScoped>
- <Feature id="xxxxx-xxx-xxxx-xxxx-xxxxxxxxxxx">
- <Name>XYZ Site Columns Feature</Name>
- </Feature>
- <Feature id="xxxxx-xxx-xxxx-xxxx-xxxxxxxxxxx">
- <Name>XYZ Content Types Feature</Name>
- </Feature>
- <Feature id="xxxxx-xxx-xxxx-xxxx-xxxxxxxxxxx">
- <Name>XYZ Feature</Name>
- </Feature>
- </SiteScoped>
- <WebScoped>
- <Feature id="xxxxx-xxx-xxxx-xxxx-xxxxxxxxxxx">
- <Name>XYZ Site Lists Feature</Name>
- </Feature>
- <Feature id="xxxxx-xxx-xxxx-xxxx-xxxxxxxxxxx">
- <Name>XYZ Event Receivers Feature</Name>
- </Feature>
- </WebScoped>
- </CustomFeatures>
- </GlobalWebApplication>
- </GlobalWebApplications>
- </Configuration>
As shown in the below image; enter Web Application URL at https://myWebApplicationURL , configure a set of features at site as well as web level as shown in in above image.
Note: Name the file as Configuration.xml only.
2: Execution
Prerequisite:
Login to SharePoint Server as Farm Administrator and copy the required files (PowerShell script and configuration XML).Configure the XML file as per your requirement.
Run:
- Run the PowerShell Script as “Run as Administrator“.
- Browse the folder path where you have kept this PowerShell script file and execute a command as shown in below image.
Note:
- As shown in above image; Script will ask you for a path where you want to keep these backup file.
- In case you have typed site collection URL wrongly this script will show you an error in red color asking you to check if you have typed the URL correctly.
3: Output Folder
- Please find below folder location which we have configured in our script to maintain a site collection backup output location.
- Output will be csv file with name as GetFeatureStatusResults, will contain information like,
a. Site Template
b. Site URL
c. Site Creation Date
d. Site collection level Feature status
e. Web Level Feature status
PowerShell Script
Read more articles on PowerShell: