Install a Powershell Module Inline Powershell VSTS

Tips and tricks Inline Powershell task VSTS, install extra Powershell modules

Maximize how you use your VSTS build and release pipeline with Inline Powershell tasks. In this blog series ‘Tips and Tricks for Inline Powershell’, I will show simple samples on how to get more out of your pipelines. This blog post: Install Powershell Module

VSTS Inline Powershell task
The Inline PowerShell VSTS task enables you to execute PowerShell from a textbox within your build or release pipeline. You can run a PowerShell script on you agent or as Azure Powershell.
Introduction Inline Powershell Task
Install Inline Powershell Task

Install Powershell Module
Powershell modules are the way to add extra functionality. Before installing the module, you need to be sure you can access the module you want to install. You can add the package manager where you package is located with Install-PackageManager, ship it with you build or download the module from the internet. Then you can install it with Install-Module or Install-Package.

Find-PackageProvider -Name "NuGet" | Install-PackageProvider -Verbose -Scope CurrentUser -Force

Install-Package SqlServer -Scope CurrentUser -Force

When installing modules you have the right to install them to the scope of the current user. You have to add the Scope parameter and set it to CurrentUser. Force makes sure the is no user interaction what can hang your powershell task. You only have to install the package provider is the module is not yet known.

More tips and tricks
Use VSTS variables
Let your task fail
Set progress
Change buildnumber
VSTS Command overview
Call a WebHook
Download a file
Install a Powershell Module
Navigate VSTS as filesystem
Make VSTS API Rest calls
Script example: Act on failed build

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: