# Scripting Upgrade Process On Windows Server

**URL:** <https://forums.plex.tv/t/scripting-upgrade-process-on-windows-server/880799>\
**Category:** Plex Media Server\
**Tags:** server-windows\
**Created:** [June 23, 2024, 2:56pm UTC](https://forums.plex.tv/t/scripting-upgrade-process-on-windows-server/880799 "2024-06-23T14:56:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![k.loud.en](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/k.loud.en/32/322428_2.png) [@k.loud.en](https://forums.plex.tv/u/k.loud.en)\
**Post date:** [June 23, 2024, 2:56pm UTC](https://forums.plex.tv/t/scripting-upgrade-process-on-windows-server/880799/1 "2024-06-23T14:56:09Z")

</div>

Server Version#: 1.40.3.8555  
Player Version#: N/A

The Plex Media Server download URL is constructed like:

[https://downloads.plex.tv/plex-media-server-new/{latest\_version}/windows/PlexMediaServer-{latest\_version}-x86\_64.exe](https://downloads.plex.tv/plex-media-server-new/%7Blatest_version%7D/windows/PlexMediaServer-%7Blatest_version%7D-x86_64.exe)

However, it does not seem that you can parse the [https://downloads.plex.tv/plex-media-server-new/](https://downloads.plex.tv/plex-media-server-new/) for a latest\_version and then construct the download url and download it that way.

I have my server functioning as a mostly “unattended” server. Many of the operations are automated through scripts. I have configured Plex Media Server to run as a windows service so using the built in update function doesnt work. I have to stop the service, manually download the new package, install it, then start the plex service again.

I have constructed scripts to do this same thing for many other services/applications; however, Im having trouble with plex. Im trying to something like this in Python:

> # Plex Media Server Downloads
> 
> plex\_url = “[https://downloads.plex.tv/plex-media-server-new/](https://downloads.plex.tv/plex-media-server-new/)”
> 
> # Get the latest version
> 
> latest\_version = get\_latest\_version(plex\_url)
> 
> if latest\_version:  
> # Construct the download URL  
> download\_url = f"[https://downloads.plex.tv/plex-media-server-new/{latest\_version}/windows/PlexMediaServer-{latest\_version}-x86\_64.exe](https://downloads.plex.tv/plex-media-server-new/%7Blatest_version%7D/windows/PlexMediaServer-%7Blatest_version%7D-x86_64.exe)"  
> print(f"\nLatest Plex Media Server version: {latest\_version}“)  
> print(f"Download link: {download\_url}”)  
> else:  
> print(“\nError fetching the latest version. Please check the provided URL or try again later.”)

But the functionality will not get passed [https://downloads.plex.tv/plex-media-server-new/](https://downloads.plex.tv/plex-media-server-new/) because it doesnt see this as a valid link.

Has anyone else scripted any such functions. Or is there another valid location to potentially grab Plex Media Server downloads.

---

<div class="post-metadata">

**Author:** ![SwiftPanda16](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/swiftpanda16/32/81839_2.png) [@SwiftPanda16](https://forums.plex.tv/u/SwiftPanda16)\
**Post date:** [June 23, 2024, 3:38pm UTC](https://forums.plex.tv/t/scripting-upgrade-process-on-windows-server/880799/2 "2024-06-23T15:38:28Z")

</div>

Look at this project.

> **[GitHub - TechieGuy12/PlexServerAutoUpdater: Automatically update Plex when...](https://github.com/TechieGuy12/PlexServerAutoUpdater)**
>
> Automatically update Plex when running the Plex service. - TechieGuy12/PlexServerAutoUpdater

---

<div class="post-metadata">

**Author:** ![k.loud.en](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/k.loud.en/32/322428_2.png) [@k.loud.en](https://forums.plex.tv/u/k.loud.en)\
**Post date:** [June 23, 2024, 5:43pm UTC](https://forums.plex.tv/t/scripting-upgrade-process-on-windows-server/880799/3 "2024-06-23T17:43:39Z")

</div>

That should work.

Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [September 21, 2024, 5:43pm UTC](https://forums.plex.tv/t/scripting-upgrade-process-on-windows-server/880799/4 "2024-09-21T17:43:46Z")

</div>

Closed on September 21, 2024, 5:43pm UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
