From 6c202a73127756c4687298d1fbe35b54cea3fcc5 Mon Sep 17 00:00:00 2001
From: James Stringer <38541878+jamesstringerparsec@users.noreply.github.com>
Date: Tue, 12 Oct 2021 09:57:37 -0700
Subject: [PATCH] Improvements
---
CopyFilesToVM.ps1 | 6 +++---
Install.ps1 | 43 ++++++++++++++++++++++++++++++++++++++++++-
autounattend.xml | 4 ++--
3 files changed, 47 insertions(+), 6 deletions(-)
diff --git a/CopyFilesToVM.ps1 b/CopyFilesToVM.ps1
index eea124b..7f6e231 100644
--- a/CopyFilesToVM.ps1
+++ b/CopyFilesToVM.ps1
@@ -5,8 +5,8 @@ param(
[string]$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\Windows\system32\GroupPolicy\User\Scripts\Logon) -eq $true) {} Else {New-Item -Path $DriveLetter\Windows\system32\GroupPolicy\User\Scripts\Logon -ItemType directory | Out-Null}
+ if((Test-Path -Path $DriveLetter\Windows\system32\GroupPolicy\User\Scripts\Logoff) -eq $true) {} Else {New-Item -Path $DriveLetter\Windows\system32\GroupPolicy\User\Scripts\Logoff -ItemType directory | Out-Null}
if((Test-Path -Path $DriveLetter\ProgramData\Easy-GPU-P) -eq $true) {} Else {New-Item -Path $DriveLetter\ProgramData\Easy-GPU-P -ItemType directory | Out-Null}
Copy-Item -Path $psscriptroot\gpt.ini -Destination $DriveLetter\Windows\system32\GroupPolicy
Copy-Item -Path $psscriptroot\psscripts.ini -Destination $DriveLetter\Windows\system32\GroupPolicy\User\Scripts
@@ -876,7 +876,7 @@ You can use the fields below to configure the VHD or VHDX that you want to creat
[ValidateNotNullOrEmpty()]
$text
)
- Write-Host "ERROR : $($text)" -ForegroundColor (Get-Host).PrivateData.ErrorForegroundColor
+ Write-Host "ERROR : $($text)"
}
##########################################################################################
diff --git a/Install.ps1 b/Install.ps1
index 769c6a5..657c494 100644
--- a/Install.ps1
+++ b/Install.ps1
@@ -8,7 +8,24 @@ if (Test-Path HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninst
(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
+ $Success = $false
+ [int]$Retries = 0
+ do {
+ try {
+ Import-Certificate -CertStoreLocation Cert:\LocalMachine\TrustedPublisher -FilePath "C:\ProgramData\Easy-GPU-P\parsecpublic.cer"
+ $Success = $true
+ }
+ catch {
+ if ($Retries -gt 4){
+ $Success = $true
+ }
+ else {
+ Start-Sleep -Seconds 5
+ $Retries++
+ }
+ }
+ }
+ While ($Success -eq $false)
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"
@@ -17,3 +34,27 @@ if (Test-Path HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninst
Stop-Process Parsec -Force
}
+ $Stoploop = $false
+[int]$Retrycount = "0"
+
+
+
+do {
+try {
+
+Write-Host "Job completed"
+$Stoploop = $true
+}
+catch {
+if ($Retrycount -gt 3){
+Write-Host "Could not send Information after 3 retrys."
+$Stoploop = $true
+}
+else {
+Write-Host "Could not send Information retrying in 30 seconds..."
+Start-Sleep -Seconds 30
+$Retrycount = $Retrycount + 1
+}
+}
+}
+While ($Stoploop -eq $false)
\ No newline at end of file
diff --git a/autounattend.xml b/autounattend.xml
index 6d21a80..13ac55b 100644
--- a/autounattend.xml
+++ b/autounattend.xml
@@ -182,13 +182,13 @@ Notes: Enter your comments here...
Allow Scripts
2
-reg add HKLM\Software\Policies\Microsoft\Windows\Powershell /v ExecutionPolicy /t REG_MULTI_SZ /d Unrestricted
+reg add HKLM\Software\Policies\Microsoft\Windows\Powershell /v Unrestricted /t REG_SZ ExecutionPolicy
false
Allow Scripts
3
-reg add HKLM\Software\Policies\Microsoft\Windows\Powershell /v EnableScripts /t REG_DWORD /d 1
+reg add HKLM\Software\Policies\Microsoft\Windows\Powershell /v 1 /t REG_DWORD EnableScripts
false