I am trying to get the SharePoint 2010 workflows running on the SharePoint list directly from the list name and not entering the list item.

But PnP PowerShell syntax needs me to enter the List item as well. Can you please help me with how can I modify the below script so that I don't need to enter the list items and could directly get the result from the list name:

$SiteURL="Enter URL"
$List="Enter List Name"
$ListItem="I don't have to use this in my script"

Connect-PnPOnline -Url $SiteURL -Credentials (Get Credentials)
Get-PnPWorkflowInstance -List $List -ListItem $ListItem

  • If you don't mind using C# instead of powershell, you can check out this link: bit.ly/2ZO1Mud Disclaimer: I'm the developer of the SPCoder tool. Jul 22, 2020 at 15:52
  • I am working on a client's machine and the URL is blocked...is there anyway I could modify my powershell script to get the output?
    – sk5991
    Jul 23, 2020 at 8:21

1 Answer 1


You could use csom to get the SharePoint 2010 workflows, below is my sample:

$webUrl = "https://tenant.sharepoint.com/sites/michael"

$listName = "TestList"
$Password ="password"
#Setup Credentials to connect
$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName,(ConvertTo-SecureString $Password -AsPlainText -Force))

$context = New-Object Microsoft.SharePoint.Client.ClientContext $webUrl
$context.Credentials = $Credentials

$web = $context.Web
$list = $web.Lists.GetByTitle($listName)

$WorkflowAssociations =$list.WorkflowAssociations;

  • Getting error while executing above script
    – sk5991
    Jul 24, 2020 at 10:53
  • Exception calling "ExecuteQuery" with "0" arguments:"The remote server returned an error: (403) Forbidden."
    – sk5991
    Jul 24, 2020 at 10:54
  • I tried adding. Add-Type -Path "C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.SharePoint.Client.dll" Add-Type -Path "C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.SharePoint.Client.Runtime.dll" Add-Type -Path "C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.Online.SharePoint.Client.Tenant.dll" But error still occurs
    – sk5991
    Jul 24, 2020 at 10:56
  • Please try to run the script in SharePoint Online Management Shell: microsoft.com/en-us/download/details.aspx?id=35588 Jul 29, 2020 at 2:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.