Creating QR Codes in PowerShell

I wrote a module as a wrapper around the .Net port of Google's ZXing library to allow me to create QR codes in PowerShell. It hasn't been used a ton, but I figured it was finally time for me to share it with the rest of the world so I published it out on my GitHub.

You can download the zip file from the main page and extract it into your modules folder. The main QR code functionality is provided by the two commands ConvertTo-QRCode and Format-QRCode. The convert function takes your input and outputs an object representing the QR code. This object is not that useful on it's own, but when piped to Format-QRCode it will display the QR code on the screen using the box drawing characters.

QRCode Exmple

The example above should scan using the Barcode Scanner App on Android and should decode to the address of this blog.

I've also included a few related functions to save barcodes as image files as well as to create a VCard string (presumably for encoding to a QR code). These functions can be used like this:

PS C:\> New-VCard -FormattedName "Chris Duck" -Url "http://blog.whatsupduck.net"
BEGIN:VCARD
VERSION:4.0
FN:Chris Duck
URL:http://blog.whatsupduck.net
END:VCARD

PS C:\> Out-BarcodeImage -Content (New-VCard -FormattedName "Chris Duck" -Url "http://blog.whatsupduck.net") -BarcodeFormat Qr_Code -ImageFormat PNG -Path c:\barcode.png

comments powered by Disqus