Created
May 19, 2018 17:06
-
-
Save zplume/e267ed6afccdc299cf8fe3938cad4188 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
$tenantUrl = "https://yourtenant.sharepoint.com" | |
$credentials = Get-Credential | |
Connect-PnPOnline -Url $tenantUrl -Credentials $credentials | |
$sites = Get-PnPSiteSearchQueryResults -All | |
Disconnect-PnPOnline | |
$script:wfStatuses = @() | |
function Get-WebWorkflowData($web) { | |
Write-Host $web.Url -ForegroundColor Yellow | |
Connect-PnPOnline -Url $web.Url -Credentials $credentials | |
$wfDefinitions = Get-PnPWorkflowDefinition | |
$wfDefinitions | ForEach-Object { | |
$wfDefinition = $_ | |
$script:wfStatuses += new-object -TypeName psobject -Property @{ | |
"SiteUrl" = $web.Url; | |
"Id" = $wfDefinition.Id; | |
"DisplayName" = $wfDefinition.DisplayName; | |
"NWFWorkflowEntitlementType" = $wfDefinition.Properties["NWConfig.WorkflowEntitlementType"]; | |
} | |
} | |
Disconnect-PnPOnline | |
} | |
$sites | ForEach-Object { | |
$site = $_ | |
Write-Host $site.Url | |
Connect-PnPOnline -Url $site.Url -Credentials $credentials | |
$webs = Get-PnPSubWebs -Recurse | |
Disconnect-PnPOnline | |
Get-WebWorkflowData -web $site | |
$webs | ForEach-Object { | |
$web = $_ | |
Get-WebWorkflowData -web $web | |
} | |
} | |
$dirPath = (Get-Location).Path | |
$script:wfStatuses | Export-Csv -NoTypeInformation -Path "$dirPath\WFStatuses.csv" -Force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment