How To Generate QR Codes with PowerShell

5

There are many ways that you can use to generate QR codes for the things you like. You may be surprised that using PowerShell could be one of the ways to generate QR codes, though not everything.

QRCodeGenerator is a PowerShell module that you can install and use to create QR codes as PNG images for three things:

  • A contact card (vCard)
  • WiFi access, and
  • Geolocation.

The module works on all PowerShell versions and editions. To get it started, you will need to install and import the module first.

Install-Module -Name QRCodeGenerator

You may be prompted that NuGet provider is required to continue. Type “Y” to continue.

To import the module once installed, set the ExecutionPolicy to Unrestrict first.

Set-ExecutionPolicy Unrestrict
Import-Module QRCodeGenerator

To generate a WiFi access QR code,

New-QRCodeWifiAccess -SSID $wifi -Password $pwd -OutPath $path
image 11 - How To Generate QR Codes with PowerShell

To generate a vCard QR code:

New-QRCodeVCard -FirstName $first -LastName $last -Company $company -Email$email -OutPath $path
image 15 - How To Generate QR Codes with PowerShell

To generate a Geolocation QR code:

New-QRCodeGeolocation -Address $address -OutPath $path
image 16 - How To Generate QR Codes with PowerShell

Here are the QR codes we just generated from these cmdlets. 

image 17 - How To Generate QR Codes with PowerShell
SHARE

5 COMMENTS

  1. Hi again Kent 🙂

    Thanks for the tip. I generated a WiFi code which seemed to scan fine but my Android phone refused to connect to the network. Said it would try, but nothing else. Will need to test other devices.

    A couple of suggested corrections…

    Several of your commands include a in the Code block, like
    Install-Module -Name QRCodeGenerator
    which mess up the command if you run them like that.

    There is a typo in the Set-ExectionPolicy code (missing the ‘u’) so that fails.

    • lol of course the editor removed the html code from my comment. The line
      “Several of your commands include a in the Code block, like”
      is referring to the html br code surrounded by the < and greater-than characters.

    • Thanks Glenn. Trying to use this new editor and it’s conflicting with another plugin that preformats the coding block. I had to disable the plugin to make it look normal. 🙂

  2. The geolocation PowerShell needs a $path appended to the end.

    Thanks for posting about this module, its been very helpful in creating a QR code for our guest wifi. Now we don’t need to give out the password, people can just scan the code with their phone. Not sure what laptop users are going to do though.

LEAVE A REPLY

Please enter your comment!
Please enter your name here