Best Practice For Deploying a PowerShell cmdlet Dependent on a C# Assembly for Use During Deployment

We are working up a deployment of one of our products using Octopus. For upgrades, one step in the process needs to be reading encrypted web.configs to harvest connection string information for migrating during the upgrade. I have an assembly that exposes a PowerShell cmdlet that can do the work, but the conventional Octopus Script Module only supports pure PowerShell.

What is the best practice for deploying this PowerShell cmdlet so I can use it early in an upgrade?

jmc

Hi jmc,

Thanks for reaching out. Loading it as a module as shown on this link would be the way to go: https://technet.microsoft.com/en-us/library/dd878307(v=vs.85).aspx

Then on your Powershell script step you’ll just import the module and use the cmdler.

Hope that helps

Dalmiro

Ok, I know how to do that. So, it looks like I wrap my assembly in a NuGetPackage, deploy it per the TechNet article, run Import-Module on the location, and run it from my scripts in this manner.


John Merryweather Cooper
Senior Software Engineer | Integration Development Group | Enterprise Notification Service
Jack Henry & Associates, Inc.® | Lenexa, KS 66214 | Ext: 431050 |JoCooper@jackhenry.commailto:JoCooper@jackhenry.com

From: Dalmiro Grañas [mailto:tender2+d8f73e8272@tenderapp.com]
Sent: Wednesday, November 4, 2015 11:31 AM
To: John Cooper JoCooper@jackhenry.com
Subject: Re: Best Practice For Deploying a PowerShell cmdlet Dependent on a C# Assembly for Use During Deployment [Questions #6158]

The e-mail below is from an external source. Please do not open attachments or click links from an unknown or suspicious origin.

Ok, I’ve assembled an MSBuild Task to call the API. I have some questions on IDs. APIKey is pretty easy. I haven’t used channels yet, so what does a Channel ID look like for passing as a string to the API? What would I use as the Project ID? Is this the Release name minus or plus the Version? Server is pretty easy. If I wanted to specify particular NuGet packages in the Release, how would I pass them in the Resource?

Oops! Wrong topic. Moving it.