mirror of
https://github.com/jamesstringerparsec/Easy-GPU-PV.git
synced 2024-08-30 18:22:17 +00:00
208 lines
8.0 KiB
PowerShell
208 lines
8.0 KiB
PowerShell
param(
|
|
$team_id,
|
|
$key
|
|
)
|
|
|
|
while(!(Test-NetConnection Google.com).PingSucceeded){
|
|
Start-Sleep -Seconds 1
|
|
}
|
|
|
|
Get-ChildItem -Path C:\ProgramData\Easy-GPU-P -Recurse | Unblock-File
|
|
|
|
if (Test-Path HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Parsec)
|
|
{}
|
|
else {
|
|
(New-Object System.Net.WebClient).DownloadFile("https://builds.parsecgaming.com/package/parsec-windows.exe", "C:\Users\$env:USERNAME\Downloads\parsec-windows.exe")
|
|
Start-Process "C:\Users\$env:USERNAME\Downloads\parsec-windows.exe" -ArgumentList "/silent", "/shared","/team_id=$team_id","/team_computer_key=$key" -wait
|
|
$configfile = Get-Content C:\ProgramData\Parsec\config.txt
|
|
$configfile += "host_virtual_monitors = 1"
|
|
$configfile += "host_privacy_mode = 1"
|
|
$configfile | Out-File C:\ProgramData\Parsec\config.txt -Encoding ascii
|
|
Copy-Item -Path "C:\ProgramData\Easy-GPU-P\Parsec.lnk" -Destination "C:\Users\Public\Desktop"
|
|
}
|
|
|
|
Function ParsecVDDMonitorSetupScheduledTask {
|
|
$XML = @"
|
|
<?xml version="1.0" encoding="UTF-16"?>
|
|
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
|
|
<RegistrationInfo>
|
|
<Description>Monitors the state of Parsec Virtual Display and repairs if broken</Description>
|
|
<URI>\Monitor Parsec VDD State</URI>
|
|
</RegistrationInfo>
|
|
<Triggers>
|
|
<LogonTrigger>
|
|
<Enabled>true</Enabled>
|
|
<UserId>$(([System.Security.Principal.WindowsIdentity]::GetCurrent()).Name)</UserId>
|
|
<Delay>PT2M</Delay>
|
|
</LogonTrigger>
|
|
</Triggers>
|
|
<Principals>
|
|
<Principal id="Author">
|
|
<UserId>$(([System.Security.Principal.WindowsIdentity]::GetCurrent()).User.Value)</UserId>
|
|
<LogonType>S4U</LogonType>
|
|
<RunLevel>HighestAvailable</RunLevel>
|
|
</Principal>
|
|
</Principals>
|
|
<Settings>
|
|
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
|
|
<DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
|
|
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
|
|
<AllowHardTerminate>true</AllowHardTerminate>
|
|
<StartWhenAvailable>false</StartWhenAvailable>
|
|
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
|
|
<IdleSettings>
|
|
<StopOnIdleEnd>true</StopOnIdleEnd>
|
|
<RestartOnIdle>false</RestartOnIdle>
|
|
</IdleSettings>
|
|
<AllowStartOnDemand>true</AllowStartOnDemand>
|
|
<Enabled>true</Enabled>
|
|
<Hidden>false</Hidden>
|
|
<RunOnlyIfIdle>false</RunOnlyIfIdle>
|
|
<WakeToRun>false</WakeToRun>
|
|
<ExecutionTimeLimit>PT72H</ExecutionTimeLimit>
|
|
<Priority>7</Priority>
|
|
</Settings>
|
|
<Actions Context="Author">
|
|
<Exec>
|
|
<Command>C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe</Command>
|
|
<Arguments>-file %programdata%\Easy-GPU-P\VDDMonitor.ps1</Arguments>
|
|
</Exec>
|
|
</Actions>
|
|
</Task>
|
|
"@
|
|
|
|
try {
|
|
Get-ScheduledTask -TaskName "Monitor Parsec VDD State" -ErrorAction Stop | Out-Null
|
|
Unregister-ScheduledTask -TaskName "Monitor Parsec VDD State" -Confirm:$false
|
|
}
|
|
catch {}
|
|
$action = New-ScheduledTaskAction -Execute 'C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe' -Argument '-file %programdata%\Easy-GPU-P\VDDMonitor.ps1'
|
|
$trigger = New-ScheduledTaskTrigger -AtStartup
|
|
Register-ScheduledTask -XML $XML -TaskName "Monitor Parsec VDD State" | Out-Null
|
|
}
|
|
Function VBCableInstallSetupScheduledTask {
|
|
$XML = @"
|
|
<?xml version="1.0" encoding="UTF-16"?>
|
|
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
|
|
<RegistrationInfo>
|
|
<Description>Install VB Cable</Description>
|
|
<URI>\Install VB Cable</URI>
|
|
</RegistrationInfo>
|
|
<Triggers>
|
|
<LogonTrigger>
|
|
<Enabled>true</Enabled>
|
|
<UserId>$(([System.Security.Principal.WindowsIdentity]::GetCurrent()).Name)</UserId>
|
|
<Delay>PT2M</Delay>
|
|
</LogonTrigger>
|
|
</Triggers>
|
|
<Principals>
|
|
<Principal id="Author">
|
|
<UserId>$(([System.Security.Principal.WindowsIdentity]::GetCurrent()).User.Value)</UserId>
|
|
<LogonType>S4U</LogonType>
|
|
<RunLevel>HighestAvailable</RunLevel>
|
|
</Principal>
|
|
</Principals>
|
|
<Settings>
|
|
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
|
|
<DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
|
|
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
|
|
<AllowHardTerminate>true</AllowHardTerminate>
|
|
<StartWhenAvailable>false</StartWhenAvailable>
|
|
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
|
|
<IdleSettings>
|
|
<StopOnIdleEnd>true</StopOnIdleEnd>
|
|
<RestartOnIdle>false</RestartOnIdle>
|
|
</IdleSettings>
|
|
<AllowStartOnDemand>true</AllowStartOnDemand>
|
|
<Enabled>true</Enabled>
|
|
<Hidden>false</Hidden>
|
|
<RunOnlyIfIdle>false</RunOnlyIfIdle>
|
|
<WakeToRun>false</WakeToRun>
|
|
<ExecutionTimeLimit>PT72H</ExecutionTimeLimit>
|
|
<Priority>7</Priority>
|
|
</Settings>
|
|
<Actions Context="Author">
|
|
<Exec>
|
|
<Command>C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe</Command>
|
|
<Arguments>-file %programdata%\Easy-GPU-P\VBCableInstall.ps1</Arguments>
|
|
</Exec>
|
|
</Actions>
|
|
</Task>
|
|
"@
|
|
|
|
try {
|
|
Get-ScheduledTask -TaskName "Install VB Cable" -ErrorAction Stop | Out-Null
|
|
Unregister-ScheduledTask -TaskName "Install VB Cable" -Confirm:$false
|
|
}
|
|
catch {}
|
|
$action = New-ScheduledTaskAction -Execute 'C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe' -Argument '-file %programdata%\Easy-GPU-P\VBCableInstall.ps1'
|
|
$trigger = New-ScheduledTaskTrigger -AtStartup
|
|
Register-ScheduledTask -XML $XML -TaskName "Install VB Cable" | Out-Null
|
|
}
|
|
Function ParsecVDDInstallSetupScheduledTask {
|
|
$XML = @"
|
|
<?xml version="1.0" encoding="UTF-16"?>
|
|
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
|
|
<RegistrationInfo>
|
|
<Description>Install Parsec Virtual Display Driver</Description>
|
|
<URI>\Install Parsec Virtual Display Driver</URI>
|
|
</RegistrationInfo>
|
|
<Triggers>
|
|
<LogonTrigger>
|
|
<Enabled>true</Enabled>
|
|
<UserId>$(([System.Security.Principal.WindowsIdentity]::GetCurrent()).Name)</UserId>
|
|
<Delay>PT2M</Delay>
|
|
</LogonTrigger>
|
|
</Triggers>
|
|
<Principals>
|
|
<Principal id="Author">
|
|
<UserId>$(([System.Security.Principal.WindowsIdentity]::GetCurrent()).User.Value)</UserId>
|
|
<LogonType>S4U</LogonType>
|
|
<RunLevel>HighestAvailable</RunLevel>
|
|
</Principal>
|
|
</Principals>
|
|
<Settings>
|
|
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
|
|
<DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
|
|
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
|
|
<AllowHardTerminate>true</AllowHardTerminate>
|
|
<StartWhenAvailable>false</StartWhenAvailable>
|
|
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
|
|
<IdleSettings>
|
|
<StopOnIdleEnd>true</StopOnIdleEnd>
|
|
<RestartOnIdle>false</RestartOnIdle>
|
|
</IdleSettings>
|
|
<AllowStartOnDemand>true</AllowStartOnDemand>
|
|
<Enabled>true</Enabled>
|
|
<Hidden>false</Hidden>
|
|
<RunOnlyIfIdle>false</RunOnlyIfIdle>
|
|
<WakeToRun>false</WakeToRun>
|
|
<ExecutionTimeLimit>PT72H</ExecutionTimeLimit>
|
|
<Priority>7</Priority>
|
|
</Settings>
|
|
<Actions Context="Author">
|
|
<Exec>
|
|
<Command>C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe</Command>
|
|
<Arguments>-file %programdata%\Easy-GPU-P\ParsecVDDInstall.ps1</Arguments>
|
|
</Exec>
|
|
</Actions>
|
|
</Task>
|
|
"@
|
|
|
|
try {
|
|
Get-ScheduledTask -TaskName "Install Parsec Virtual Display Driver" -ErrorAction Stop | Out-Null
|
|
Unregister-ScheduledTask -TaskName "Install Parsec Virtual Display Driver" -Confirm:$false
|
|
}
|
|
catch {}
|
|
$action = New-ScheduledTaskAction -Execute 'C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe' -Argument '-file %programdata%\Easy-GPU-P\ParsecVDDInstall.ps1'
|
|
$trigger = New-ScheduledTaskTrigger -AtStartup
|
|
Register-ScheduledTask -XML $XML -TaskName "Install Parsec Virtual Display Driver" | Out-Null
|
|
}
|
|
|
|
ParsecVDDMonitorSetupScheduledTask
|
|
VBCableInstallSetupScheduledTask
|
|
ParsecVDDInstallSetupScheduledTask
|
|
|
|
Start-ScheduledTask -TaskName "Install VB Cable"
|
|
Start-ScheduledTask -TaskName "Install Parsec Virtual Display Driver"
|
|
Start-ScheduledTask -TaskName "Monitor Parsec VDD State" |