No ratings

K2 Management Shell



The K2 Management Shell provides PowerShell cmdlets as wrapper around the K2 API?s so that administrators and developers can more easily manipulate K2 in a programmatic fashion. This solution was developed specifically for K2 4.7 and K2 Five. The cmdlets have not been tested with previous versions and there are no plans to make it work with older versions. It has been tested on Server 2012 R2 and Server 2016 and requires .Net Framework 4.6.1. This solution is provided as-is and should be tested before being put to use in any production environment. The cmdlets are fully functional and will work with other common PowerShell commands (i.e. Select-Object, Where-Object, Sort-Object). Any cmdlets that accept input from the pipeline will also be called out in the description of the parameters they use.


This solution was developed to minimize activities that would usually require manual database changes or read access to the K2 database. Since all cmdlets use the underlying K2 API there are no permissions required to the K2 database. This also means that all permissions specified in K2 apply to the user executing the cmdlets. For example, if the user executing Get-K2ProcessInstance doesn?t have rights to a particular process they will not see it listed.

The next step for this solution is to eliminate the need for manually changing configuration files on the K2 server. For now, only common configuration change related cmdlets are available but more will be added in the future. As this will require rights to update these files the logged in user will need administrative rights on the K2 server.




Inside the zip file with this solution you will find a file called installK2ManagementShell.ps1. This script will deploy the dll to the GAC and will create the needed folder structure on the K2 server. It should be run on the K2 server as it will connect to the local machine. If your environment has a separate tier for the K2 application layer you will need to install it there.


Once that has been run it will place a shortcut on your desktop which will automatically load module needed to run the K2 PowerShell cmdlets. This shortcut will also load the OOB snap-in provided for the Deploy-Package and Write-DeploymentConfig cmdlets. Alternatively, the module can be manually imported once the installation script has been run by using the following cmdlet in the PowerShell console:


Import-Module K2ManagementShell.dll

Version history
Last update:
‎12-15-2017 01:41 PM
Updated by: