Date and Month display

Get associated workflows across site collection level

<#
******-----------------------------------------------------------------------******
Author          -> Shiv Mangal Singh
Date            -> 8th Feb - 2017
Description     -> This Script will get all Associated Workflows across site collection level for list & document library.
Path of csv file->$path = "D:\contosoMW_Team\Shiv\Workflow1.CSV"
Site Collection Name --> "https://ms.contoso.net/global/contososs"

#Call the function to get all workflow Report
GetWorkflowReport "https://ms.contoso.net/global/contososs" "D:\contosoMW_Team\Shiv\Workflow1.CSV"
******-----------------------------------------------------------------------******
 #>

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

Function GetWorkflowReport($SiteURL, $Path)
{
$Site = Get-SPSite $SiteURL
# Creating the Header TAB for workflow report
"Site Collection `t Sub Site URL `t Title `t List `t Associated Workflow `t Workflow ID" | Out-File $Path
# loop through All subsites across site collection
foreach($Web in $Site.AllWebs)
{
  foreach($list in $Web.Lists)
  {
   #Write-Host $list.Title
    # Check Associtaed Workflow through all sub sites
    foreach($Wf in $list.WorkflowAssociations)
    {
     Write-Host $Wf.Name
     "$($SiteURL) `t $($web.Url) `t $($web.Title) `t $($list.Title) `t $($Wf.Name) `t $($Wf.Id)" | Out-File $Path -Append
    }

  }
}
} # End Function

# Export Workflow Report in CSV file
GetWorkflowReport "https://ms.contactd.contoso.net/global/contososs" "D:\contosoMW_Team\Shiv\Workflow1.CSV"

No comments:

Post a Comment