PowerShell Snippet #10 Check Version Number is Valid


Lately I’ve been working on PowerShell Modules that are published to PowerShell Gallery as part of a build process in VSTS. And so I’ve been creating version numbers and passing them as variables. However I wanted to validate them before they were applied. Below is a sample of how to verify that the version number you’re pushing conforms to semver

PowerShell Snippet #8 Build SSDT With MicrosoftDataToolsMSbuild


Below the “how to” script, there are two functions for you; the first will download MicrosoftDataToolsMSBuild. The second will compile an SSDT project/solution using downloaded package. There are no other prerequisites other than MSBuild Tools being downloaded/installed on the box.

PowerShell Snippet #7 Alter PowerShell Module Version

Hello! Wow, day 7 already! And for today’s post, we getting meta. I have a few builds on VSTS that run PSScriptAnalyzer on some PowerShell modules, and also runs some tests. After these steps have run successfully I publish to both NuGet and PowerShell Gallery (yes that’s right, Continuous Development FTW). Packaging via NuGet is simple enough: there’s several out-of-the-box NuGet steps in VSTS, including even a Custom step that allows you to submit version number/prefix. [Read More]

PowerShell Snippet #6 Test DotNet Version Installed

Hello! Continuing on with our daily PowerShell Advent Calendar Extravaganza, this script here will return the current .NET version installed on the machine. You can either choose to add the target .NET version or not. If you add a .NET version number and at least that version isn’t on the machine, the script will throw an error, but will continue to run and return the PSObject, unless you set the “ErrorAction” to “Stop”. [Read More]

PowerShell Snippet #5 RunPsScriptAnalyzer on VSTS Hosted Build

Hello! As someone who has some PowerShell modules knocking about, it’s important to get some checks running prior to publishing. As these modules are in source control, it makes sense to launch builds that run PSScriptAnalyzer as soon as a pull request is made on the branch. But running PSScriptAnalyzer on the hosted build agent is a little difficult as not only does it not come with it installed, the service account running the builds don’t have permissions to install it! [Read More]

PowerShell Snippet #3 Install Nuget Packages Using PowerShell


When I was recently putting together a repo I needed to get a few packages from Nuget. I wanted also wanted to automate getting the packages for when other people downloaded the repo and ran the scripts. So it made sense to create a function that would download the package and test that the download was successful.

For info, read the synopsis!

PowerShell Snippet #1 - Trimming The String


When building up urls from different parameters in something like TeamCity, or Octopus, it’s simple enough to get double “//” in urls if the parameters are not consistent. So little helper functions are always useful to have imported to manage such things. Below is an example of such a thing!

PoshSSDTBuildDeploy 2.0 Released Generate Scripts

Hello! Today I’ve finally got around to altering PoshSSDTBuildDeploy to generate the deployment scripts/report. These can be generated with or without Publishing the changes. Run-Test file has examples of how this works. It is however, a breaking change, hence the update to version 2. This is because I moved from using the Deploy method to the Publish method. You can read about this method on the SSDT Blog Post. This method was introduced way back in October 2016. [Read More]