#############################################
# Title: List_All_Custom_infopath_in_Web_Application.ps1
# Description: List All Custom infopath in Web Application.ps1
# Created By : Suresh Kumar Durairaj
# Parameter1 : $webapps_Url <Web Application Url "http://vspd9:11111/">
# Parameter2 : $InfoPathForms_Report <Csv File path C:\Temp\InfoPathForms_Report.csv >
#############################################
#region Addins
if((Get-PSSnapin | Where {$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null)
{
Add-PSSnapin Microsoft.SharePoint.PowerShell
}
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Publishing")
[System.Reflection.Assembly]::LoadWithPartialName("System")
[System.Reflection.Assembly]::LoadWithPartialName("System.IO")
#endregion
$outputObj = @()
$webapps_Url = "http://vspd9:11111/"
$InfoPathForms_Report= "C:\Temp\InfoPathForms_Report.csv"
$webApp = Get-SPWebApplication $webapps_Url
foreach ($site in $webApp.Sites) {
foreach($web in $site.AllWebs) {
for($i = 0; $i -ne $web.lists.count; $i++) {
$list = $web.Lists[$i]
if ($list.BaseTemplate -eq "XMLForm" -and $list.BaseType -eq "DocumentLibrary")
{
if ($list.AllowContentTypes -eq $true)
{
foreach ($contenttype in $list.ContentTypes)
{
if ($contenttype.Name -ne "Form" -and $contenttype.Name -ne "Folder")
{
$FORM = New-Object PSObject
$FORM | Add-Member NoteProperty Type "Form"
$FORM | Add-Member NoteProperty Site $($List.ParentWeb.Title)
$FORM | Add-Member NoteProperty Web_URL $($List.ParentWeb.URL)
$FORM | Add-Member NoteProperty List_Title $($List.Title)
$FORM | Add-Member NoteProperty List_Url $($Web.Url + "/" + $List.RootFolder.Url)
$FORM | Add-Member NoteProperty Infopath_Name $($contenttype.Name)
$outputObj += $FORM
}
}
}
}
}
}
}
$outputObj | Export-CSV -Path $InfoPathForms_Report -NoTypeInformation
#region Remove addins
Remove-PsSnapin Microsoft.SharePoint.PowerShell
#endregion
# Title: List_All_Custom_infopath_in_Web_Application.ps1
# Description: List All Custom infopath in Web Application.ps1
# Created By : Suresh Kumar Durairaj
# Parameter1 : $webapps_Url <Web Application Url "http://vspd9:11111/">
# Parameter2 : $InfoPathForms_Report <Csv File path C:\Temp\InfoPathForms_Report.csv >
#############################################
#region Addins
if((Get-PSSnapin | Where {$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null)
{
Add-PSSnapin Microsoft.SharePoint.PowerShell
}
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Publishing")
[System.Reflection.Assembly]::LoadWithPartialName("System")
[System.Reflection.Assembly]::LoadWithPartialName("System.IO")
#endregion
$outputObj = @()
$webapps_Url = "http://vspd9:11111/"
$InfoPathForms_Report= "C:\Temp\InfoPathForms_Report.csv"
$webApp = Get-SPWebApplication $webapps_Url
foreach ($site in $webApp.Sites) {
foreach($web in $site.AllWebs) {
for($i = 0; $i -ne $web.lists.count; $i++) {
$list = $web.Lists[$i]
if ($list.BaseTemplate -eq "XMLForm" -and $list.BaseType -eq "DocumentLibrary")
{
if ($list.AllowContentTypes -eq $true)
{
foreach ($contenttype in $list.ContentTypes)
{
if ($contenttype.Name -ne "Form" -and $contenttype.Name -ne "Folder")
{
$FORM = New-Object PSObject
$FORM | Add-Member NoteProperty Type "Form"
$FORM | Add-Member NoteProperty Site $($List.ParentWeb.Title)
$FORM | Add-Member NoteProperty Web_URL $($List.ParentWeb.URL)
$FORM | Add-Member NoteProperty List_Title $($List.Title)
$FORM | Add-Member NoteProperty List_Url $($Web.Url + "/" + $List.RootFolder.Url)
$FORM | Add-Member NoteProperty Infopath_Name $($contenttype.Name)
$outputObj += $FORM
}
}
}
}
}
}
}
$outputObj | Export-CSV -Path $InfoPathForms_Report -NoTypeInformation
#region Remove addins
Remove-PsSnapin Microsoft.SharePoint.PowerShell
#endregion
No comments:
Post a Comment