-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.ps1
31 lines (23 loc) · 1.01 KB
/
setup.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#Requires -RunAsAdministrator
Write-Output "Setting up MPC Presence"
# Check for Python 3
if (-not([bool] (Get-Command python3))) {
Write-Output "Python 3 not found! Exiting!"
Pause
exit
}
# Install all required python packages
pip install pypresence
pip install requests
pip install lxml
pip install beautifulsoup4
# Register Task for Auto Startup
$create_startup = $Host.UI.PromptForChoice("Startup", "Do you want to create a startup task?", ('&Yes', '&No'), 0)
if (-not($create_startup -eq 0)) {
Write-Host "Skipping Autostart Task!"
exit
}
$action = New-ScheduledTaskAction -Execute "silent.vbs" -WorkingDirectory $PSScriptRoot
$trigger = New-ScheduledTaskTrigger -AtLogOn
$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -RestartCount 3 -RestartInterval (New-TimeSpan -Minutes 1) -StartWhenAvailable -ExecutionTimeLimit 0
Register-ScheduledTask -TaskName "Start MPC Presence Hidden" -TaskPath "\Custom\" -Trigger $trigger -Action $action -Settings $settings