Auto Install Parsec (attempt 1)

This commit is contained in:
James Stringer 2021-10-12 03:55:11 -07:00
parent 4bb0972351
commit 2b5b524921
5 changed files with 64 additions and 1 deletions

View File

@ -1,4 +1,41 @@
Function Add-VMGpuPartitionAdapterFiles {
function add-gpo-modifications {
param(
[string]$DriveLetter
)
$querygpt = Get-content $DriveLetter\Windows\System32\GroupPolicy\gpt.ini
$matchgpt = $querygpt -match '{42B5FAAE-6536-11D2-AE5A-0000F87571E3}{40B6664F-4972-11D1-A7CA-0000F87571E3}'
if ($matchgpt -contains "*0000F87571E3*" -eq $false) {
$gptstring = get-content $DriveLetter\Windows\System32\GroupPolicy\gpt.ini
$gpoversion = $gptstring -match "Version"
$GPO = $gptstring -match "gPCMachineExtensionNames"
$add = '[{42B5FAAE-6536-11D2-AE5A-0000F87571E3}{40B6664F-4972-11D1-A7CA-0000F87571E3}]'
$replace = "$GPO" + "$add"
(Get-Content "$DriveLetter\Windows\System32\GroupPolicy\gpt.ini").Replace("$GPO","$replace") | Set-Content "$DriveLetter\Windows\System32\GroupPolicy\gpt.ini"
[int]$i = $gpoversion.trim("Version=")
[int]$n = $gpoversion.trim("Version=")
$n +=2
(Get-Content $DriveLetter\Windows\System32\GroupPolicy\gpt.ini) -replace "Version=$i", "Version=$n" | Set-Content $DriveLetter\Windows\System32\GroupPolicy\gpt.ini
}
else{
write-output "Not Required"
}
}
Function Setup-ParsecInstall {
param(
[string]$DriveLetter
)
add-gpo-modifications -DriveLetter $DriveLetter
if((Test-Path -Path $DriveLetter\Windows\system32\GroupPolicy\Machine\Scripts\Startup) -eq $true) {} Else {New-Item -Path $DriveLetter\Windows\system32\GroupPolicy\Machine\Scripts\Startup -ItemType directory | Out-Null}
if((Test-Path -Path $DriveLetter\Windows\system32\GroupPolicy\Machine\Scripts\Shutdown) -eq $true) {} Else {New-Item -Path $DriveLetter\Windows\system32\GroupPolicy\Machine\Scripts\Shutdown -ItemType directory | Out-Null}
if((Test-Path -Path $DriveLetter\ProgramData\Easy-GPU-P) -eq $true) {} Else {New-Item -Path $DriveLetter\Windows\system32\GroupPolicy\Machine\Scripts\Easy-GPU-P -ItemType directory | Out-Null}
Move-Item -Path $psscriptroot\psscripts.ini -Destination $DriveLetter\Windows\system32\GroupPolicy\Machine\Scripts
Move-Item -Path $psscriptroot\Install.ps1 -Destination $DriveLetter\Windows\system32\GroupPolicy\Machine\Scripts\Startup
Move-Item -Path $psscriptroot\parsecpublic.cer -Destination $DriveLetter\ProgramData\Easy-GPU-P
}
Function Add-VMGpuPartitionAdapterFiles {
param(
[string]$hostname = $ENV:COMPUTERNAME,
[string]$DriveLetter,

19
Install.ps1 Normal file
View File

@ -0,0 +1,19 @@
while(!(Test-NetConnection Google.com).PingSucceeded){
Start-Sleep -Seconds 1
}
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")
(New-Object System.Net.WebClient).DownloadFile("https://builds.parsec.app/vdd/parsec-vdd-0.37.0.0.exe", "C:\Users\$env:USERNAME\Downloads\parsec-vdd.exe")
Start-Process "C:\Users\$env:USERNAME\Downloads\parsec-windows.exe" -ArgumentList "/silent", "/shared" -wait
Import-Certificate -CertStoreLocation Cert:\LocalMachine\TrustedPublisher -FilePath "C:\ProgramData\Easy-GPU-P\parsecpublic.cer" | Out-Null
Start-Process "C:\Users\$env:USERNAME\Downloads\parsec-vdd.exe" -ArgumentList "/silent" -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
Stop-Process Parsec -Force
}

3
gpt.ini Normal file
View File

@ -0,0 +1,3 @@
[General]
gPCMachineExtensionNames=[{42B5FAAE-6536-11D2-AE5A-0000F87571E3}{40B6664F-4972-11D1-A7CA-0000F87571E3}]
Version=4

BIN
parsecpublic.cer Normal file

Binary file not shown.

4
psscripts.ini Normal file
View File

@ -0,0 +1,4 @@
[Startup]
0CmdLine=c:\Windows\system32\GroupPolicy\Machine\Scripts\Startup\Install.ps1
0Parameters=