PowerShell Brickset Module – Part 1: Getting Started

I recently gave my PowerShell Brickset Module a much needed overhaul, so thought it was worth putting a few posts out on how it works and what you can do with it. In part 1 we’ll look at getting started, including download and installation.

Brickset is an extremely useful site for keeping up-to-date with Lego based news and managing your own collection of brick based goodness. In addition to the browser based content, they also offer a SOAP based API.  My PowerShell Brickset Module takes advantage of this API and provides a number of functions for working with different parts of the site. The recent overhaul of the module includes functions for working with the inventory side of things, i.e. the part which requires a login – the previous version was based only around functions which needed an API key.

Brickset Requirements

To take advantage of all of the module functions you will require both a Brickset account and an API key. Fill out the form here  for an API key and they will send you one. Currently they are free.

Installation

The easiest way to install the Brickset module is to use PowerShell v5 and get it from the PowerShell Gallery. To do that is a single command:

otherwise you can get it from Github, instructions in the previous post.

Once installed, import the module and check out the available commands:

Brickset Connection

One of the new functions in this release is Connect-Brickset. This replaces Set-BricksetAPIKey and handles the API key, the User login (if supplied) and the Webservice connection. Run Connect-Brickset and both your API key and user login will be available for all connections in the session, stored via the $BricksetConnection variable:

Use Cases

You can still do all of the same things as in the previous release, such as getting the number of Lego sets per theme:

To drill down into detailed information for a range of sets, we could do something like this:

In part 2 we will look at getting hold of instruction PDFs and Part 3 onto some of the new functions that require a login for managing your inventory…..