Bart Simons

Bart Simons

Thoughts, stories and ideas.

Bart Simons



.net .net 5 .net core Apache C# CentOS LAMP NET Framework Pretty URLs Windows Server WireGuard access log add analysis android api at the same time authentication authorization automate automation azure azurerm backup bash basics batch bootstrap build capture cheat sheet chromium chroot class cli click to close code coverage code snippet command line commands compile compiling compression containers control controller controlling convert cpu usage create credentials csv csvparser curl data dd deployment desktop detect devices disable diskpart dism distributed diy docker dom changes dotnet core drivers ease of access encryption example export file transfer files fix folders framework generalize getting started ghost gui guide gunicorn gzip html html tables icewarp igd imagex import inotify install installation interactive ios iphone itunes java javascript jquery json kiosk kotlin linux live load data loading screen lock screen loopback audio lxc lxd lxml macos manage manually message messages minio mirrored mod_rewrite monitor monitoring mstest mutationobserver mysql net 5 nexmo nginx no oobe node node.js nodejs not installing notification notifications object storage on desktop one command openssl owncloud parallels parallels tools parse perfect philips hue play port forwarding powershell processing ps-spotify python quick raspberry pi record rip ripping rsync rtmp save save data sbapplication scraping script scripting scriptingbridge scripts security send server service sharedpreferences sms songs sonos spotify spotify api spotlight ssh stack streaming streamlink studio sudo swarm swift sync sysprep system audio systemd tables terminal testing tracking tutorial twilio ubiquiti ubuntu ubuntu 18.04 ui code unifi unlock unsplash source upnp uptime usb tethering wallpapers wasapi website websites webview windows windows 10 without itunes without oobe workaround xaml

ps-spotify, a PowerShell module to control the Spotify Web API.

In my previous article I demonstrated my dotnet core Spotify authentication 'gateway'. With your access and refresh tokens available, it is time to actually use them: for that, you need a client. You could choose to send raw API requests out to Spotify, but for the sake of 'why not?' I have created a PowerShell module that provides a front-end to the Spotify API - for example, you can use Find-SpotifyItem to search for a song, right from your command prompt or terminal. I have developed this module without any serious intentions, but it can actually be used in various situations:

Configuring ps-spotify

The file contains clear and updated instructions, covering the installation and configuration of ps-spotify on your system.

Before you get started, please remember to fill in your refresh token (you can get this token with the webapp discussed in my previous article) and basic bearer token (base64 encoded string of client id:client secret) in ps-spotify.psm1 - otherwise this module will not work! You can use this website to generate the base64 encoded string that is needed for the SpotifyBasicBearer.

ps-spotify setup

Good! Now we can finally use the module by importing it.

ps-spotify import module

If this shows no errors, you are ready and good to go.
I have written some examples below for demonstration purposes, feel free to try them out!

Getting the currently playing device (Get-SpotifyConnectDevice)


Setting the volume of the currently playing device (Set-SpotifyConnectVolume)


Play and pause Spotify

Set-SpotifyConnectPlay and Set-SpotifyConnectPause

Play "start me up"


I hope that my work and commitment on this project and other open-source projects is appreciated. Have a great day!

Bart Simons

Bart Simons

View Comments