Get all Workflows in a SharePoint Site
Download:
https://drive.google.com/open?id=1Kt0WqtoXV8UxfX7HpFWtj2oMnyXuOgsf
param ([boolean] $writeToFile = $true)
#List all workflows in farm
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #If boolean is set to true, you can specify an outputlocation, to save to textfile.
if($writeToFile -eq $true)
{
$outputPath = Read-Host "Outputpath (e.g. C:directoryfilename.txt)"
}
#Counter variables
$webcount = 0
$listcount = 0
$associationcount = 0
#Grab all webs
Get-SPSite -Limit All | % {$webs += $_.Allwebs}
if($webs.count -ge 1)
{
foreach($web in $webs)
{
#Grab all lists in the current web
$lists = $web.Lists
foreach($list in $lists)
{
$associations = @()
#Get all workflows that are associated with the current list
foreach($listassociation in $list.WorkflowAssociations)
{
$associations += $($listassociation.name)
}
$listcount +=1
if($associations.count -ge 1)
{
Write-Host "Website"$web.url -ForegroundColor Green
Write-Host " List:"$list.Title -ForegroundColor Yellow
foreach($association in $associations){Write-Host " -"$association}
if($WriteToFile -eq $true)
{
Add-Content -Path $outputPath -Value "Website $($web.url)"
Add-Content -Path $outputPath -Value " List: $($list.Title)"
foreach($association in $associations){Add-Content -Path $outputPath -Value " -$association"}
Add-Content -Path $outputPath -Value "`n"
}
}
}
$webcount +=1
$web.Dispose()
}
#Show total counter for checked webs & lists
Write-Host "Amount of webs checked:"$webcount
Write-Host "Amount of lists checked:"$listcount
$webcount = "0"
}
else
{
Write-Host "No webs retrieved, please check your permissions" -ForegroundColor Red -BackgroundColor Black
$webcount = "0"
}
- Blogger Comment
Subscribe to:
Post Comments
(
Atom
)
Category
- Active Directory ( 8 )
- App Packaging ( 6 )
- BitLocker ( 9 )
- CrashPlan ( 7 )
- DNS ( 1 )
- DocLink ( 2 )
- Excel ( 3 )
- Exchange ( 7 )
- Group Policy ( 2 )
- Javascript ( 1 )
- M365 ( 5 )
- OneDrive ( 1 )
- OneNote ( 1 )
- Power Apps ( 1 )
- Power Automate ( 1 )
- Power BI ( 11 )
- PowerShell ( 54 )
- SCCM ( 28 )
- SCCM Device Collections ( 12 )
- SCCM Reports ( 12 )
- SCCM User Collection ( 2 )
- SCSM ( 4 )
- SharePoint ( 52 )
- SharePoint Design ( 20 )
- Skype for Business ( 1 )
- SQL Server ( 3 )
- SSL Certificates ( 3 )
- Teams ( 6 )
- Windows 10 ( 3 )
- Windows 7 ( 4 )
- Windows Server ( 5 )
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.