Introduction to “PowerShell Module to Play Music”:

This is in continuation to one of my previous blog post wherein I wrote a script to play random songs in the background using the Powershell console.

Though there are already some Windows Media player automation scripts available in the community, I was looking for something that as easy as  “Single cmdlet” and provides easy controls like Shuffle, Loop, Stop, ShowPlayList and Filter hence I wrote this script myself.


Video Demo:


I’ve included few more functionalities to the script which are following

  1. Plays in background

    Plays all music in the background on a hidden Windows Media Player Instance and you can continue with your work.
    PowerShell Module to Play Music
  2. Filter Audio Files
    PowerShell Module to Play Music
  3. Music Controls
    Enables you to Control your music from the Shell no need to switch windows, by providing options like

    1. Shuffle

    2. Loop
      PowerShell Module to Play Music
    3. Stop

  4. Now Playing Notifications

    You get notified by an Information balloon in the bottom right corner of your screen whenever a new audio starts playing. This balloon will pop up every time one audio ends and a new one starts.

    PowerShell Module to Play Music
    On Windows 10 Machine


    On Windows 7 Machine
  5. Stores\Caches last accessed directory

    This function caches/stores information of last accessed directory in a temporary file so that you don’t have to provide Music directory every time you run the function
  6. Displays information and user preferences

    Provides information like Number of Songs that will be played, Total Play duration, and Mode chosen by the user in the PowerShell console itself.
  7. Support Switch aliasesAll music control switches and parameters support Aliases for all those lazy people out there 😛

How it works (The Core Logic): 

PowerShell Module to Play Music


    1. On PowerShell v5.x: You can install the MusicPlayer module directly from the PowerShell Gallery

      PowerShell Module to Play Music

    2. On PowerShell v4 and Earlier:

GitHub Repository [Fork it!]: 

Get the complete script from my GitHub Repository here

Hoping you’ll find it fun and useful, cheers.. signing off…


Subscribe to our mailing list

* indicates required