param([
switch
]
$help
)
[void][System.Reflection.Assembly]::LoadWithPartialName(
"Microsoft.SharePoint"
"Microsoft.SharePoint.Publishing"
function
GetHelp() {
$HelpText
= @"
DESCRIPTION:
This script will list out the webparts type along with the names in publishing pages in any site .
"@
}
RahulPublishingPageWebParts() {
write-host
"This script will enlist the webparts used in all publishing pages in this site"
"Please enter theURL of the site"
$siteURL
= read-host
$site
= New-Object Microsoft.SharePoint.SPSite(
$web
=
.OpenWeb()
$webPublish
= [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb(
$pages
.GetPublishingPages()
foreach
(
$page
in
{
$manager
.GetLimitedWebPartManager(
.Url,[System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)
$webCollection
.WebParts
if
.
Count
-ne 0)
"The page "
.Title
" contains these webparts"
for
$i
=0;
-lt
;
++)
write-host (
+ 1).ToString()
" "
[
].
GetType
().Name
].Title
.Dispose()
) { GetHelp; Continue }
else
{ RahulPublishingPageWebParts }
Fernando Lugão Veltem edited Revision 4. Comment: remove en-us from title
Craig Lussier edited Revision 3. Comment: added en-US to tags and title. removed long and unneeded tags not in line with tagging protocols
Ed Price - MSFT edited Revision 1. Comment: TItle casing and tags