Recently I have decided to do as much as I can via PowerShell instead of using the GUI that is installed by default on most Windows operating systems. I built a media server/test box at home which has Windows Server 2016 installed without a GUI, which led me to my first task.
How do I install Plex via PowerShell?
It turns out it is actually incredibly easy, I have documented two ways to do it depending on whether you wish to use Chocolatey or not. (If you need help installing Chocolatey or have no idea what it is, check here.)
First up for it to work and not throw up missing DLL errors we need to install the Media Foundation feature for Server 2016. We do this as we would any other windows feature, by using the Install-WindowsFeature cmdlet.
Once this is done we need to restart and then we can install Plex Media Server from the Chocolatey Package Provider (if you don’t want to use Chocolatey then scroll down and I explain another way to do it).
Install-Package -Name PlexMediaServer -ProviderName Chocolatey
Now if we do a Get-Package we can see the Plex Media Server is installed.
That is pretty much all we have to do. From here if you open a web browser on another computer and navigate to Plex on your media server you can configure the Plex settings and it is good to go.
The URL will look like this but with the IP address of your own Plex Server:
If you don’t want to use Chocolatey we can use a PowerShell cmdlet called Invoke-Webrequest to connect to the Plex website and download the Plex installer for us. From there we run it as a normal .exe and install it. Here is how we do that.
Firstly as with the method above we need to install Microsoft Media Foundation first.
Restart your machine and then we are ready to download the installer file from the Plex website. The exact URL for the .exe you are about to download could be different, the only way I know of how to get it is go to the Plex website on a machine with a GUI and copy the link.
This command will download the Plex installer and save it as C:\PMS.exe:
Invoke-WebRequest -URI https://downloads.plex.tv/plex-media-server/18.104.22.16834-995f1dead/Plex-Media-Server-22.214.171.12434-995f1dead.exe -OutFile C:\PMS.exe
This will download the file like below:
When that is done it is as simple as running C:\PMS.exe and following the Plex installation GUI that is presented on screen and then heading to the Plex URL in a browser on another machine to configure the Plex settings.
As mentioned earlier the URL will look like this but with the IP address of your own Plex Server: