A Quick Look at the New PowerShell Activities in the DPM and VMM IPs

A Quick Look at the New PowerShell Activities in the DPM and VMM IPs

  • Comments 3
  • Likes

When we on the product team create an integration pack for a product, whether it’s for System Center or another Microsoft products, or even a 3rd-party product, our goal is not to try and replicate everything that product does in the form of runbook activities. First of all, not everything a product does makes sense to try and automate because they might only be done once or twice in the lifetime of the installation. What we do is try to cover core scenarios with activities that help accomplish what data center admins need to do on a regular basis.

The second reason why we don’t do that is scalability. When our runbook activities are a combination of multiple actions on the target product, it requires new effort to develop and release each additional activity, and we simply cannot scale to provide quality integration packs that contain 50 or 100 activities, let alone cover the 466 PowerShell cmdlets available in the latest release of VMM.

This is why, in the integration packs for System Center 2012 Data Protection manager and Virtual Machine Manager, we include new activities for running free-form PowerShell scripts. These activities are designed to allow you the flexibility to do use any of the PowerShell cmdlets exposed by the product in a way that’s much easier to use than the Run .NET Script activity. These activities, “Run DPM PowerShell Script” and “Run VMM PowerShell Script” take advantage of their integration with the DPM and VMM IPs to offer some benefits over Run .NET Script:

  • They re-use the connection configuration you’ve already specified for DPM or VMM, so you don’t have to expose any server names or credentials in a script.
  • They automatically handle running the commands locally or remotely, depending on where your admin console is installed and specified in the connection settings
  • When possible, they re-use existing PowerShell runspaces and connections to remote computers, improving performance and reducing the amount of connections into your remote computers.
  • They allow up to 20 output variables to be published to the data bus simply by specifying the variable name on the properties page.

Using the activity is pretty simple. Just put your PowerShell script in the “PowerShell Script” property (I know, it seems obvious). Your script can be a single line command or it can be a full script. Hint – since the view limits you to a single line, you should always right-click and select Expand to get a bigger window to enter your script.

image

In this simple script, I’m just getting a VMM Server object and returning the Port property from it into a new variable called $portnumber. Then I just put portnumber as an output variable to enable publishing that value to the data bus.

image

Note: you can use “portnumber” or “$portnumber” and either one will work.

When I run the activity in the Runbook tester, I can see the property value is output to published data:

image

Wasn’t that simple? No longer will you have to create PSCredential objects and set up remote sessions and Invoke-Command. It’s all taken care of for you behind the scenes!

So when you’re using the DPM or VMM IPs and you need to do something that the IP doesn’t provide a discrete activity for, think of the PowerShell script activities in the IP and how those could be used to fill those gaps.

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Very clever idea! May I suggest carrying this same idea over to the VMware vCenter IP? By integrating the VMware vCenter IP with VMware's PowerCLI, you can achieve the exact same functionality as this. That would be most excellent! - Brian Pavnick | Veeam Software | Solutions Architect

  • Me again. This would be extremely useful for pretty much any other IP, imo. I can think of many uses for this in SCOM. - vbpav

  • Yep. I agree. The issue is that only the VMM and DPM IP's share the same PowerShell infrastructure behind the scenes, so it was easy to implement the activity on both of those. None of the other IPs share that infrastructure, so adding that capability to the other IPs becomes much more of an effort.