Sitecore: Sample Powershell Script to Push Items through Workflow

Sitecore: Sample Powershell Script to Push Items through Workflow

The Sitecore PowerShell Extensions (SPE) module is a Sitecore development accelerator which can drastically increase your productivity and curtail the amount of time it takes to deliver a Sitecore solution.

The module provides a command line (CLI) and scripting environment (ISE) for automating tasks. SPEworks with the Sitecore process, capable of making native calls to the Sitecore API and manipulating files. Running commands and writing scripts follow the standard and well-known Windows PowerShell syntax.

Sitecore PowerShell Extensions: a command line and scripting tool

https://sitecorepowershell.gitbooks.io/sitecore-powershell-extensions/

 

Download from Sitecore Marketplace

https://marketplace.sitecore.net/en/Modules/Sitecore_PowerShell_console.aspx

 

The are scenarios where you are working with large volume of content. To prevent the sitecore event queue from getting overloaded one can run a powershell script in the background and force items to Approved state.

Sample PowerShell Script to force items through workflow

$items = Get-Item “/sitecore/content/Home/Test” -Language “en”

get-childitem -Item $items -Language “en” -recurse | Invoke-Workflow -CommandName “Approve” -Language “en-GB”

 

Happy Sitecoring!

Leave a Reply