New to Powershell so keep this in mind....I've successfully used powershell scripts to do work on my Sharepoint site. What I'm unclear on is this. Given certain functions I'm pretty certain an object is returned from my pnp function but what I'm not sure of (and this is the general part of my question) if an object is returned what is the object and how do I access its properties...realizing this is likely different for each object returned.
As an example, I issued the Get-PNPWorkflowInstance to find workflows which are suspended and kill them. The code loops and finds and kills the workflows which are suspended. Here's part of that code.
The question is this. What is the object and how to I access the object or expose it's properties. Been trying to find documentation on this but I think its my knowledge gap (a gap I want to fill) in terms of OOP. Thanks.
Foreach ($Item in $Items)
{
Get-PnPWorkflowInstance -List $List -ListItem $Item | Where-Object {($_.Status -eq "Suspended" -or $_.Status -eq "Not Started" -or $_.Status -eq "Started" -or $_.Status -eq "Failed on Start" -or $_.Status -eq "Error Occurred" -or $_.Status -eq "Canceled" -or $_.Status -eq "Canceled" -or $_.Status -eq "Failed on Start (retrying)" -or $_.Status -eq "Error Occurred (retrying)")} |
Foreach-Object {
$WorkflowInstance = $_
$Subscription = $AllSubs | Where-Object {$_.Id -eq $WorkflowInstance.WorkflowSubscriptionId}
$_.Id
Stop-PnPWorkflowInstance -Identity $_ -Verbose -Force
Start-PnPWorkflowInstance -Subscription $Subscription -ListItem $Item.Id
}
$Counter++
}