Skip Ribbon Commands
Skip to main content

Quick Launch

Todd Klindt's home page > Todd Klindt's Office 365 Admin Blog > Posts > Use PowerShell to Work with SharePoint 2010 Workflow Scan
July 29
Use PowerShell to Work with SharePoint 2010 Workflow Scan

Workflow Retirement Series TOC

Part 1 - SharePoint 2010 and 2013 Workflows Kaput in Office 365
Part 2 - Finding All the SharePoint 2010 Workflows in SharePoint Online
Part 3 - Find Only the Active SharePoint 2010 Workflows in SharePoint Online 
Part 4 - Use PowerShell to Work with SharePoint 2010 Workflow Scan

In Part 2 of my much beloved “Workflow Retirement Series” I covered how to scan your SharePoint Online environment for those pesky SharePoint 2010 workflows with the free SharePoint Modernization Scanner. I figured that was that. I was preparing to do my victory lap when I started getting some feedback. It seems some folks have a a lot of workflows in their environment, and a CSV file with a few hundred, or a few thousand rows isn’t terribly helpful. Now, once you get that CSV file into Excel you have one of the best data slicing and dicing tools invented by man at your disposal. You can slap a couple of filters on there, sort a few columns, hide a few others, and you can probably get whatever information you need. But I’m a PowerShell guy. I like to do things the hard way, with maximum typing. Let’s walk through what I did.

One of the reports the SharePoint Modernization Scanner makes is

ModernizationWorkflowScanResults.csv  and that’s the one I’m going to use. Since it’s a pretty well formed CSV file we can import it into an object without much fuss:

$results = Import-Csv .\ModernizationWorkflowScanResults.csv

As a gut check we can see how many rows we brought in:

$results.Count

You can also type $results[0] to see the first row, since it’s just an object. And since it’s an object, it has Members that we can exploit. What are those Members? I’m glad you asked:

$results | Get-Member

image

My eagle-eyed readers will notice that the NoteProperties are the column headers in the CSV file. To get my feet below me I did a simple Select to get a few properties:

$results | select "Definition Name",Version

You can add any of the columns you want. Remember to put quotes around the columns with spaces in the name.

$results | select "Definition Name","Subscription Name","List Title",Version,enabled

Depending on how your PowerShell host is configured that might be wide enough that might switch from table to list. To get it back to table pipe it through Format-Table:

$results | Select-Object "Definition Name","Subscription Name","List Title",Version,enabled,"Flow upgradability" | Format-Table –AutoSize

SNAGHTML192591b3

This report has both SharePoint 2010 and SharePoint 2013 workflows in it. The current fire is around SharePoint 2010 workflows, so let’s just look at those:

$results | Where-Object -Property version -EQ -Value "2010" | Select-Object "Definition Name","Subscription Name","List Title",Version,enabled,"Flow upgradability" | Format-Table -AutoSize

That should give you a better picture of the Herculean task in front of you. There’s one final piece I want to show you, and that’s how to see which sites have the most workflows:

$results | Where-Object -Property version -EQ -Value "2010" | Select-Object "Definition Name","List Title",enabled,"Site Url" | Group-Object -Property "Site Url" | Format-Table –AutoSize

SNAGHTML1926b330

This will help you figure out where to focus your efforts between now and November 1st.

Like I said at the beginning of this post, all of this and more is available in Excel and most of it has been done for you already in the Office 365 Classic workflow inventory.xlsx report that the SharePoint Modernization Scanner creates. But it’s a fun PowerShell exercise just the same.

tk

ShortURL: https://www.toddklindt.com/PoshWorkflowScan

Comments

Great Blog!

I do see multiple workflows in a single workflow history list. Using PnP, How can i filter based on the "Date Occurred" and export it to excel? Thank you in advance.
 on 9/14/2020 10:16 AM

Add Comment

Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.

Title


Body *


Today's date *

Select a date from the calendar.
Please enter today's date so I know you are a real person

Twitter


Want a message when I reply to your comment? Put your Twitter handle here.

Attachments

 

 SysKit