Compare commits
1 Commits
9bbb8e1bd7
...
8077181dce
| Author | SHA1 | Date | |
|---|---|---|---|
| 8077181dce |
@@ -1,8 +1,16 @@
|
|||||||
Unregister-ScheduledTask -TaskName "MediaServer" -Confirm:$false
|
Unregister-ScheduledTask -TaskName "MediaServer" -Confirm:$false -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
# Get the project root directory (two levels up from this script)
|
# Get the project root directory (two levels up from this script)
|
||||||
$projectRoot = (Get-Item $PSScriptRoot).Parent.Parent.FullName
|
$projectRoot = (Get-Item $PSScriptRoot).Parent.Parent.FullName
|
||||||
$action = New-ScheduledTaskAction -Execute "python" -Argument "-m media_server.main" -WorkingDirectory $projectRoot
|
|
||||||
|
# Find Python executable
|
||||||
|
$pythonPath = (Get-Command python -ErrorAction SilentlyContinue).Source
|
||||||
|
if (-not $pythonPath) {
|
||||||
|
Write-Error "Python not found in PATH. Please ensure Python is installed and accessible."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
$action = New-ScheduledTaskAction -Execute $pythonPath -Argument "-m media_server.main" -WorkingDirectory $projectRoot
|
||||||
$trigger = New-ScheduledTaskTrigger -AtStartup
|
$trigger = New-ScheduledTaskTrigger -AtStartup
|
||||||
$principal = New-ScheduledTaskPrincipal -UserId "$env:USERNAME" -LogonType S4U -RunLevel Highest
|
$principal = New-ScheduledTaskPrincipal -UserId "$env:USERNAME" -LogonType S4U -RunLevel Highest
|
||||||
$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -StartWhenAvailable
|
$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -StartWhenAvailable
|
||||||
|
|||||||
Reference in New Issue
Block a user