Wednesday, January 15, 2014

SharePoint 2010: PowerShell scripts for generating farm inventory

Introduction
In this post, I present PowerShell scripts that I use to generate various listsings, such as sites, lists, permissions, etc.

Inventory Listing of Farm Sites and their Configurations

This script generates a listing of all sites in the farm, across all web applications, that includes such configuration details as: Create Date, Create Author, Template name and ID, RecycleBinEnabled, etc.  There are more fields available than included in this script - to find out all of the available fields, pipe the base script into the Get-Member object.
Add-PSSnapin Microsoft.SharePoint.PowerShell Get-SPWebApplication http://[your website] | Get-SPSite -Limit All | Get-SPWeb -Limit All | Select Title, Name, Created, URL, ID, ParentWebID, Language, WebTemplate, WebTemplateID, Theme, IsRootWeb, Author, Description, RecycleBinEnabled, SiteAdministrators, SiteGroups | Export-CSV \\[intranet location]\results.csv -NoTypeInformation

Inventory Listing of Farm Lists and their Configurations

$SiteLists = foreach ($site in get-spsite) { foreach ($web in $site.AllWebs) { foreach ($list in $web.lists) {$list} } } $SiteLists | Select parentWebURL, parentWeb, Title, Hidden, Author, Created, itemCount, Description | Export-CSV \\[intranet location]\FileName.csv -NoTypeInformation

Inventory Listing of installed SharePoint products

Get-WmiObject -Class Win32_Product | Where {$_.Name -like “*SharePoint*”} | Sort -Property Name | ft -Autosize

References

No comments: