magritton
9/15/2016 - 9:27 PM

This gets all of the instances in SharePoint where InfoPath is used. Both Libraries and Lists

This gets all of the instances in SharePoint where InfoPath is used. Both Libraries and Lists

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

$fileName = "f:temp\xsn-" + $(Get-Date -Format "yyyyMMddHHmmss") + ".csv"
$cnt = 0
$webAppURL = "https://xxxx"
$wa = Get-SPWebApplication($webAppURL)
foreach($site in $wa.Sites)
{
    foreach ($web in $site.AllWebs) 
	{
        foreach($list in $web.Lists)
        {
			if ($list.BaseType -eq "DocumentLibrary" -and $list.BaseTemplate -eq "XMLForm")
			{
				"$($list.title) `t $webAppURL$($list.DefaultViewUrl) `t Library" | out-file $fileName -Append
				"$webAppURL"+"$($list.DefaultViewUrl)"
			}
			elseif ($list.ContentTypes[0].ResourceFolder.Properties["_ipfs_infopathenabled"])
			{
				"$($list.title) `t $webAppURL$($list.DefaultViewUrl) `t List" | out-file $fileName -Append
				"$webAppURL"+"$($list.DefaultViewUrl)"
			}
			else
			{
				$check = 0
				foreach($c in $list.ContentTypes) 
				{
					if($c.DocumentTemplateUrl.ToString().EndsWith("xsn") -eq $true)
					{
						$check++
					}
				}
				if($check -gt 0)
				{
					"$($list.title) `t $webAppURL$($list.DefaultViewUrl) `t List" | out-file $fileName -Append
					"$webAppURL"+"$($list.DefaultViewUrl)"
				}
			}
		}
	}
			
}
"Count:"
$cnt
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

$fileName = "f:temp\xsn-" + $(Get-Date -Format "yyyyMMddHHmmss") + ".csv"
$cnt = 0
$wa = Get-SPWebApplication("https:/xxxx")
foreach($site in $wa.Sites)
{
    foreach ($web in $site.AllWebs) 
	{
        foreach($list in $web.Lists)
        {
			if ($list.BaseType -eq "DocumentLibrary" -and $list.BaseTemplate -eq "XMLForm")
			{
				"$($list.title) `t $($list.parentweb.url)$($list.DefaultViewUrl) `t Library" | out-file $fileName -Append
			}
			elseif ($list.ContentTypes[0].ResourceFolder.Properties["_ipfs_infopathenabled"])
			{
				"$($list.title) `t $($list.ParentWeb.URL)$($list.DefaultViewUrl) `t List" | out-file $fileName -Append
			}
			else
			{
				$check = 0
				foreach($c in $list.ContentTypes) 
				{
					if($c.DocumentTemplateUrl.ToString().EndsWith("xsn") -eq $true)
					{
						$check++
					}
				}
				if($check -gt 0)
				{
					"$($list.title) `t $($list.ParentWeb.URL)$($list.DefaultViewUrl) `t List" | out-file $fileName -Append
				}
			}
		}
	}
			
}
"Count:"
$cnt