SharePoint 2007 – Content Audit: Print All Workflows

In this post I would discuss the PowerShell script to query all workflows in SharePoint farm. You may have deployed custom Workflow solutions like custom activities available on CodePlex or built workflows in SharePoint Designer or Visual Studio. It’s important to understand what sort of workflows you have running in your environment & their upgradability to properly plan an upgrade project.

There is no way in SharePoint to say whether a workflow has been built on SharePoint Designer or Visual Studio. Thus, we would use the SPList Workflow Associations property to get all Workflows & then filter-out the ones we don’t care like standard approval workflows.


# Print all workflows in Web Application
function PrintWorkflowDetails(){

    $rootSite = new-object Microsoft.SharePoint.SPSite("");
    $webApp = $rootSite.WebApplication;

    foreach($site in $webApp.Sites){
        foreach($web in $site.AllWebs){
            foreach($list in $web.Lists){
                foreach($wkfAssociation in $list.WorkflowAssociations){
                    # Include only current versions
                    # Exclude all built-in approval workflows
                    if($wkfAssociation.Name.contains("Previous") -or $wkfAssociation.Name.Contains("Approval") -or $wkfAssociation.Name.contains("Disposition") ){
                        $data = @{
                                "Site URL" = $wkfAssociation.ParentSite.Url
                                "Web URL" = $wkfAssociation.ParentWeb.Url
                                "List" = $list.Title
                                "Workflow" =  $wkfAssociation.Name
                        New-Object PSOBJECT -Property $data


PrintWorkflowDetails | OUT-GRIDVIEW 
#PrintWorkflowDetails | Select-Object "Site URL" , "Web URL", "List", "Workflow" | Export-Csv -NoTypeInformation -Path "\WorkflowInventory.csv"


Popular posts from this blog

SharePoint 2013 Search Service Activation Error

VMWare Workstation - Assign a static IP address

SharePoint 2007 - Content Audit: Print last modified & ownership of all sites