Skip to content

Instantly share code, notes, and snippets.

@KakersUK
KakersUK / plex-anti-sleep.ps1
Last active September 12, 2024 21:01
PowerShell 7 script to stop the PC from going to sleep if there are any active streams
# Plex on Windows Anti-Sleep
#
# References
# Gist: https://gist.github.com/KakersUK/d090e1836ffb881d29c9f529b380f795
# Install PowerShell 7: https://learn.microsoft.com/en-gb/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.3#winget
# X-Plex-Token: https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/
# Host variables
$PlexHost = '127.0.0.1'
$PlexPort = 32400