If you have multiple playback devices connected to your PC, you might want to switch between them programmatically. This script uses the Spotify Web API and PowerShell to switch between playback devices.
# Install the Spotify Web API module Install-Module -Name SpotifyWebAPI spotify premium pc powershell top
# Set the device ID $deviceId = "device_id" If you have multiple playback devices connected to
# Set your Spotify credentials $clientId = "your_client_id" $clientSecret = "your_client_secret" spotify premium pc powershell top