In this blog post I will show you how to build two custom activities based on PowerShell commands. I will be using the Orchestrator beta and Quick Integration Kit 3. The Quick Integration Kit (QIK) enables you to extend your library of activities, with new custom integration packs and activities. QIK features a Command Line Interface (CLI) Wizard that allows you to describe how to run Command Line Interfaces (such as Windows Commands, SSH or PowerShell) and capture their output as Published Data. The QIK CLI Wizard provides a mechanism for very rapidly producing activities without the need for programming, given the readily available libraries of PowerShell from Microsoft and other community sources. In this blog post we will build two activities, one for counting files in a folder and one for list all files with a specific extension (for example mp3 files) in a folder. We will use QIK CLI that will help us build an integration pack (IP) around in this scenario two PowerShell commands. Let´s start with the one counting files
- Start Opalis QIK CLI. After default installation of QIK there will be a shortcut on your desktop
- Welcome to the Opalis QIK CLI, click Next
- Assembly QIK CLI, input a name for example ContosoFileAssembly
- Assembly QIK CLI, browse and input where the file will be created, for example C:\TEMP\FILEIP\ContosoFileIPAssembly.dll
- Assembly QIK CLI, click Next
- Commands, click Add…
- Add/Edit Command, General, input
- Add/Edit Command, Arguments,
- Add/Edit Command, Published Data, click Add
- Add/Edit Command, Published Data, click OK
- Commands, click Next
- Click Finish
We now have a dll file, a .NET assembly. We can now use the invoke .NET activity in the QIK IP to test the DLL before we build the IP. Start the System Center Orchestrator Runbook Designer and build a simple runbook to use the Invoke .NET activity and a Send Platform Event activity. To get the Invoke .NET activity you need to import the QIK IP. It is located at C:\Program Files (x86)\Opalis Software\Quick Integration Kit 3\Integration Packs after default QIK installation. Don’t forget to input a folder under Properties of the Invoke .NET activity. Configure the Send Platform Event activity to publish the count data from the Invoke .NET activity. Run the policy and verify that you get a result in the Send Platform Event activity.
Time to add the second activity, that should list all files with a specific extension in a folder.
- Start QIK CLI again, on the Welcome screen, click “Load from QIK CLI Assembly” and select your dll file (C:\TEMP\FILEIP\ContosoFileIPAssembly.dll)
- Assembly Details, click Assembly Information and raise version to 1.0.0.1. Click OK
- Assembly Details, click Next
- Commands, click Add…
- Input the following settings
- General, Name: List specific files in folder
- General, Mode: Run Windows PowerShell
- Arguments, Parameters, add
- Name: Folder
- Usage mode: Command Argument
- Display Style: Folder
- Echo as published data: Check
- Arguments, Parameters, add
- Name: File Extension
- Usage mode: Command Argument
- Display Style: Text
- Echo as published data: Check
- Arguments, Command Line, input “(Get-childitem $(Folder) | where {$_.Extension -eq ‘$Extension)’})
- Published Data, add
- Name: _Fullname
- Property: fullname
- Description: File path
- Published Data, add
- Name: _Name
- Property: name
- Description: Name of the file
- Published Data, add
- Name: _Length
- Property: Length
- Description: File size
- Published Data, click OK
- Commands, click Next
- When the wizard complete successfully you can can test the new command in the console with the .NET Invoke activity. Else, to build the integration pack, click Build Integration Pack. It is the same wizard that you can start direct from the shortcut “QIK Wizard”
- Input the following settings
- Opalis Quick Integration Kit Wizard, product details, input
- Category Name: Contoso File Management
- Manufacturer: Contoso
- Opalis Quick Integration Kit Wizard, product details, click Next
- Opalis Quick Integration Kit Wizard, objects, click Next
- Opalis Quick Integration Kit Wizard, dependencies, click Next
- Opalis Quick Integration Kit Wizard, Opalis Integration Pack File, input where to create the IP, for example C:\TEMP\FILEIP\ContosoFile.oip . Click Next
- Opalis Quick Integration Kit Wizard, The QIK Wizard Succeeded, click Finish
Now, use the Deployment manager to register IP with Orchestrator Management server and deploy IP to runbook servers and runbook designers. You can then use your new integration pack and activities in runbooks 🙂
Please note that this is provided “as is†with no warranties at all. If you want to take a look at my demo files send me a e-mail, I will upload them after some extra activites has been added. Download QIK here.
Hi Anders,
Thank you for the answer ! That would be a nice suprise for when they release SC 2012 ! 😉
… Or eventually for a service pack.
Anyway, thank you for sharing your great work !
Hi, last time I asked there was no supported way to build them. I guess there are of course, as MSFT is doing it, but there is no public documentation around how to do it.
Hi,
Do you know how I could create a Prerequisit Configuration tool (the window that you can open in the Runbook Designer Options menu), like the one in the Active Directory IP ?
I’d like to build an IP that would interact with a remote server to configure connection parameters to it without having to to it in each activity.
I’m looking forward to hearing from you,
Best regards,
Nicolas
hi, you should add for mail follower link your site.
Excellent Andres you are trually a gem of a person.
Best Regards
Gurbinder
[…] as Sleep is its own activity. More examples with the Orchestrator Integration Toolkit can be found here. You can download my sleep IP here. ContosoSleep . Please note that this is provided “as is†[…]