Created
May 13, 2016 09:28
-
-
Save mjendza/fd60c4d4ccaa58e0ab9b96f36cf755d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Read-Onet{ | |
param ( | |
[string] $path | |
) | |
asnp *sharepoint* | |
$file = "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\" + "TEMPLATE\" + $path+"\xml\onet.xml"; | |
write-host $file | |
if (Test-Path $file) { | |
[xml]$onet = Get-Content $($file) | |
# write-host $onet | |
$onet.Project.Configurations.Configuration.SiteFeatures|% { | |
$feature = $_; | |
#write-host $feature.Feature.ID | |
try{ | |
Get-SPFeature -Identity [string]$feature.Feature.ID | |
} | |
catch{ | |
Write-Error $_ -ErrorAction Continue | |
} | |
} | |
$onet.Project.Configurations.Configuration.WebFeatures|% { | |
$feature = $_; | |
#write-host $feature.Feature.ID | |
try{ | |
Get-SPFeature -Identity [string]$feature.Feature.ID | |
} | |
catch{ | |
Write-Error $_ -ErrorAction Continue | |
} | |
} | |
} | |
} | |
function Get-InstalledSiteDefinitions { | |
param ( | |
[int] $lang = 1045 | |
) | |
if ($lang -eq $NULL) { $lang = 1045; } | |
#C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\1045\XML | |
$path = "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\" + "TEMPLATE\" + $lang + "\XML\WEBTEMP*.xml"; | |
if (Test-Path $path) { | |
write-host $path | |
Select-String -Path $path -Pattern '(?:<Template[^>]+SetupPath="(?<SetupPath>[^"]+)"[^>]*>)' -AllMatches | ForEach-Object { Read-Onet -path $_.Matches[0].Groups[1].Value } | Sort-Object | |
} | |
} | |
Get-InstalledSiteDefinitions $args[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment