Hi All,
If you would like to retrieve all the workflow which is running in Moss 2007 you can use below PS script to list out all the workflow in CSV file.
#Load SharePoint 2007 Assemblies
[void][system.reflection.assembly]::load("Microsoft.sharepoint, version=12.0.0.0, culture=neutral, publickeytoken=71e9bce111e9429c")
# Script variables
$date = get-date -format "yyyy-MM-dd_HH-mm"
# Workflow Variables
$WFExport = "c:\\scripts\\exports\\Workflows_$date.csv"
# Main Body
# Creating Export File
out-file -filepath $WFExport -inputobject "|"
# Looping through Web Applications, Site Collections, Webs and Lists
$Farm = [Microsoft.SharePoint.Administration.SPFarm]::Local
$Service = $Farm.Services | Where{$_.TypeName -eq "Windows SharePoint Services Web Application"}
$WebApps = $Service.WebApplications
Foreach ($WebApp in $WebApps)
{
$Sites = $WebApp.Sites
Foreach ($Site in $Sites)
{
$Webs = $Site.AllWebs
Foreach ($Web in $Webs)
{
$Lists = $Web.Lists
Foreach ($List in $Lists)
{
$Workflows = $List.WorkflowAssociations
Foreach ($Workflow in $Workflows)
{
If ($Workflow.Name -notlike "Previous Version*")
{
out-file -filepath $WFExport -append -inputobject($Workflow.Name + "|" + $Workflow.InternalName + "|"+ $WebApp.Name + "|" + $Site.RootWeb.Title + "|" + $Web.Title + "|" + $Web.URL + "|" + $List.Title + "|")
}
}
}
}
}
}
Happy Coding !!
Thanks
Pankaj Srivastava
by Pankaj Srivastava via Everyone's Blog Posts - SharePoint Community
No comments:
Post a Comment