PowerShell: Elencare Id, Scope e folder delle features
Tramite questo script in PowerShell 1.0 è possibile elencare tutte le feature presenti sul filesystem di SharePoint 2007 (WSS3 - MOSS) visualizzandone Id, Scope e nome della cartella.
l'output è simile al seguente
PowerShell
$pathFeatures = "'C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\";
Get-ChildItem "$pathFeatures\*' -Recurse
| Where-Object {$_.Name.ToLower().Equals("feature.xml")}
| ForEach-Object -Process {
$fn = $_.FullName;
[xml]$f = Get-Content $fn;
"* " + $f.Feature.id + " " + $f.Feature.Scope + " - " + $_.Directory.Name;
}
Text
* D250636F-0A26-4019-8425-A5232D592C09 Web - AddDashboard
* FEAD7313-AE6D-45DD-8260-13B563CB4C71 Web - AdminLinks
* 395702F0-184C-46a2-9BB5-0A64B048738C Farm - Analytics
* 56DD7FE7-A155-4283-B5E6-6147560601EE Web - AnalyticsLinks
* 00BFEA71-D1CE-42de-9C63-A44004CE0104 Web - AnnouncementsList
* B21B090C-C796-4b0f-AC0F-7EF1659C20AE Site - BaseSite
* 97A2485F-EF4B-401f-9167-FA4FE177C6F6 Farm - BaseSiteStapling
.
.
.