Scenario 1:
As we discussed in comments, If you don't have the Path
and ID
of the workflow item
then you need to use a Query
to get the item like below.
Get-Item -Path "master:" -Query "/sitecore/system/Workflows//*[@@templatename='Workflow']" | Where-Object { $_.Name -eq "<Your Workflow Name>"}
So in the above query, we have to provide the location where Sitecore
maintains all the workflows. i.e. /sitecore/system/Workflows
Using the above query, it will get all the items by filtering with the template name and item name.
Scenario 2:
Using the same approach we will get the children of the Workflow
that we get from the query and then loop through its child items to identify the state
like this.
$workflow = Get-Item -Path "master:" -Query "/sitecore/system/Workflows//*[@@templatename='Workflow']" | Where-Object { $_.Name -eq "<Your state name>"}
Get-ChildItem -ID $workflow.Id | Where-Object { $_.Name -eq "Deployed"}
Hope this helps.