mirror of
https://github.com/jamesstringerparsec/Easy-GPU-PV.git
synced 2024-08-30 18:22:17 +00:00
Working?!
This commit is contained in:
parent
7101232711
commit
5f2fa12156
@ -2,15 +2,35 @@
|
||||
|
||||
Function Setup-ParsecInstall {
|
||||
param(
|
||||
[string]$DriveLetter
|
||||
[string]$DriveLetter,
|
||||
[string]$Team_ID,
|
||||
[string]$Key
|
||||
)
|
||||
|
||||
$new = @()
|
||||
|
||||
$content = get-content "$PSScriptRoot" + "\user\psscripts.ini"
|
||||
|
||||
foreach ($line in $content) {
|
||||
if ($line -like "0Parameters="){
|
||||
$line = "0Parameters=-team_id=$Team_ID -team_key=$Key"
|
||||
$new += $line
|
||||
}
|
||||
Else {
|
||||
$new += $line
|
||||
}
|
||||
}
|
||||
Set-Content -Value $new -Path "$PSScriptRoot" + "\user\psscripts.ini"
|
||||
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\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\ProgramData\Easy-GPU-P -ItemType directory | Out-Null}
|
||||
Copy-Item -Path $psscriptroot\cert.bat -Destination $DriveLetter\ProgramData\Easy-GPU-P
|
||||
Copy-Item -Path $psscriptroot\gpt.ini -Destination $DriveLetter\Windows\system32\GroupPolicy
|
||||
Copy-Item -Path $psscriptroot\psscripts.ini -Destination $DriveLetter\Windows\system32\GroupPolicy\User\Scripts
|
||||
Copy-Item -Path $psscriptroot\Install.ps1 -Destination $DriveLetter\Windows\system32\GroupPolicy\User\Scripts\Logon
|
||||
Copy-Item -Path $psscriptroot\User\psscripts.ini -Destination $DriveLetter\Windows\system32\GroupPolicy\User\Scripts
|
||||
Copy-Item -Path $psscriptroot\User\Install.ps1 -Destination $DriveLetter\Windows\system32\GroupPolicy\User\Scripts\Logon
|
||||
Copy-Item -Path $psscriptroot\Machine\psscripts.ini -Destination $DriveLetter\Windows\system32\GroupPolicy\Machine\Scripts
|
||||
Copy-Item -Path $psscriptroot\Machine\Install.ps1 -Destination $DriveLetter\Windows\system32\GroupPolicy\Machine\Scripts\Startup
|
||||
Copy-Item -Path $psscriptroot\parsecpublic.cer -Destination $DriveLetter\ProgramData\Easy-GPU-P
|
||||
}
|
||||
|
||||
@ -255,6 +275,18 @@ function Convert-WindowsImage {
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]$GPUName,
|
||||
|
||||
[Parameter(ParameterSetName="SRC")]
|
||||
[Alias("TeamID")]
|
||||
[string]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]$Team_ID,
|
||||
|
||||
[Parameter(ParameterSetName="SRC")]
|
||||
[Alias("Team_Key")]
|
||||
[string]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]$Key,
|
||||
|
||||
[Parameter(ParameterSetName="SRC")]
|
||||
[switch]
|
||||
$CacheSource = $false,
|
||||
@ -2369,7 +2401,7 @@ You can use the fields below to configure the VHD or VHDX that you want to creat
|
||||
}
|
||||
|
||||
Write-W2VInfo "Setting up Parsec to install at boot"
|
||||
Setup-ParsecInstall -DriveLetter $WindowsDrive
|
||||
Setup-ParsecInstall -DriveLetter $WindowsDrive -Team_ID $team_id -Key $key
|
||||
|
||||
if ($DiskLayout -eq "UEFI")
|
||||
{
|
||||
@ -4187,10 +4219,12 @@ param(
|
||||
[int]$CPUCores,
|
||||
[string]$GPUName,
|
||||
[float]$GPUResourceAllocationPercentage,
|
||||
[string]$SourcePath
|
||||
[string]$SourcePath,
|
||||
[string]$Team_ID,
|
||||
[string]$Key
|
||||
)
|
||||
#New-vhd -SizeBytes $HDDSize -Path "C:\Users\Public\Documents\Hyper-V\Virtual hard disks\$VMName.vhdx" -Dynamic
|
||||
Convert-WindowsImage -SourcePath $SourcePath -Edition $Edition -VHDFormat $Vhdformat -VHDPath $VhdPath -DiskLayout $DiskLayout -UnattendPath $UnattendPath -GPUName $GPUName | Out-Null
|
||||
|
||||
Convert-WindowsImage -SourcePath $SourcePath -Edition $Edition -VHDFormat $Vhdformat -VHDPath $VhdPath -DiskLayout $DiskLayout -UnattendPath $UnattendPath -GPUName $GPUName -Team_ID $Team_ID -Key $Key| Out-Null
|
||||
New-VM -Name $VMName -MemoryStartupBytes $MemoryAmount -VHDPath $VhdPath -Generation 2 -SwitchName "Default Switch" | Out-Null
|
||||
Set-VM -Name $VMName -ProcessorCount $CPUCores -CheckpointType Disabled -LowMemoryMappedIoSpace 3GB -HighMemoryMappedIoSpace 32GB -GuestControlledCacheTypes $true -AutomaticStopAction ShutDown
|
||||
Set-VMMemory -VMName $VMName -DynamicMemoryEnabled $false
|
||||
@ -4212,6 +4246,8 @@ $params = @{
|
||||
UnattendPath = "$PSScriptRoot"+"\autounattend.xml"
|
||||
GPUName = "NVIDIA GeForce GTX 1050 Ti with Max-Q Design"
|
||||
GPUResourceAllocationPercentage = 25
|
||||
Team_ID = "1mhDZ8RNbpGwFYwGYrMu9ewwcby"
|
||||
Key = "ae31d6e201227b7caa977a0a9bce83652e67f29662d284c5e5c20db61e6d16d2"
|
||||
}
|
||||
|
||||
|
||||
@ -4219,3 +4255,4 @@ New-GPUEnabledVM @params
|
||||
|
||||
|
||||
|
||||
Start-VM -Name GPU-P
|
60
Install.ps1
60
Install.ps1
@ -1,60 +0,0 @@
|
||||
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
|
||||
$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 9){
|
||||
$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"
|
||||
$configfile += "host_privacy_mode = 1"
|
||||
$configfile | Out-File C:\ProgramData\Parsec\config.txt -Encoding ascii
|
||||
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)
|
33
Machine/Install.ps1
Normal file
33
Machine/Install.ps1
Normal file
@ -0,0 +1,33 @@
|
||||
<#
|
||||
if (!(Test-Path C:\ProgramData\Easy-GPU-P\second.txt)) {
|
||||
exit
|
||||
}
|
||||
else {
|
||||
if( !((Get-ChildItem -Path Cert:\CurrentUser\TrustedPublisher).DnsNameList.Unicode -like "Parsec Cloud, Inc.")) {
|
||||
$Success = $false
|
||||
[int]$Retries = 0
|
||||
do {
|
||||
try {
|
||||
Import-Certificate -CertStoreLocation Cert:\CurrentUser\TrustedPublisher -FilePath C:\ProgramData\Easy-GPU-P\parsecpublic.cer
|
||||
$Success = $true
|
||||
}
|
||||
catch {
|
||||
if ($Retries -gt 60){
|
||||
$Success = $true
|
||||
}
|
||||
else {
|
||||
Start-Sleep -Seconds 1
|
||||
$Error[0] |Out-File C:\ProgramData\Easy-GPU-P\log.txt
|
||||
$env:USERNAME | Out-File C:\ProgramData\Easy-GPU-P\username.txt
|
||||
$Retries++
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
While ($Success -eq $false)
|
||||
|
||||
}
|
||||
Else {
|
||||
}
|
||||
}
|
||||
#>
|
@ -1,4 +1,4 @@
|
||||
|
||||
[Logon]
|
||||
[Startup]
|
||||
0CmdLine=Install.ps1
|
||||
0Parameters=
|
53
User/Install.ps1
Normal file
53
User/Install.ps1
Normal file
@ -0,0 +1,53 @@
|
||||
param(
|
||||
$team_id,
|
||||
$key
|
||||
)
|
||||
|
||||
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")
|
||||
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
|
||||
$currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) | Out-File C:\ProgramData\Easy-GPU-P\admim.txt
|
||||
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
|
||||
}
|
||||
|
||||
<#
|
||||
if (!((Get-ChildItem -Path Cert:\CurrentUser\TrustedPublisher).DnsNameList.Unicode -like "Parsec Cloud, Inc.")) {
|
||||
cmd /c C:\ProgramFiles\Easy-GPU-P\cert.bat
|
||||
}
|
||||
|
||||
Invoke-Item Cert:\CurrentUser\TrustedPublisher
|
||||
start-sleep -s 30
|
||||
|
||||
|
||||
if (!((Get-ChildItem -Path Cert:\CurrentUser\TrustedPublisher).DnsNameList.Unicode -like "Parsec Cloud, Inc.")) {
|
||||
Import-Certificate -CertStoreLocation Cert:\CurrentUser\TrustedPublisher -FilePath C:\ProgramData\Easy-GPU-P\parsecpublic.cer
|
||||
if (!(Test-Path C:\ProgramData\Easy-GPU-P\second.txt)) {
|
||||
New-Item -ItemType File -Path C:\ProgramData\Easy-GPU-P\second.txt
|
||||
Restart-Computer
|
||||
}
|
||||
}
|
||||
#>
|
||||
|
||||
|
||||
#if(((Get-ChildItem -Path Cert:\CurrentUser\TrustedPublisher).DnsNameList.Unicode -like "Parsec Cloud, Inc.")) {
|
||||
if (!(Get-WmiObject Win32_VideoController | Where-Object name -like "Parsec Virtual Display Adapter")) {
|
||||
cmd /c C:\ProgramFiles\Easy-GPU-P\cert.bat
|
||||
Start-Process "C:\Users\$env:USERNAME\Downloads\parsec-vdd.exe" -ArgumentList "/silent"
|
||||
}
|
||||
|
||||
<#}
|
||||
Else {
|
||||
Restart-Computer
|
||||
}
|
||||
#>
|
4
User/psscripts.ini
Normal file
4
User/psscripts.ini
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
[Logon]
|
||||
0CmdLine=Install.ps1
|
||||
0Parameters=-team_id 1mhDZ8RNbpGwFYwGYrMu9ewwcby -key ae31d6e201227b7caa977a0a9bce83652e67f29662d284c5e5c20db61e6d16d2
|
@ -131,7 +131,7 @@ Notes: Enter your comments here...
|
||||
<CEIPEnabled>0</CEIPEnabled>
|
||||
</component>
|
||||
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<ComputerName>-PC</ComputerName>
|
||||
<ComputerName>GPU-P</ComputerName>
|
||||
<ProductKey>W269N-WFGWX-YVC9B-4J6C9-T83GX</ProductKey>
|
||||
</component>
|
||||
</settings>
|
||||
@ -182,13 +182,13 @@ Notes: Enter your comments here...
|
||||
<SynchronousCommand wcm:action="add">
|
||||
<Description>Allow Scripts</Description>
|
||||
<Order>2</Order>
|
||||
<CommandLine>reg add HKLM\Software\Policies\Microsoft\Windows\Powershell /v Unrestricted /t REG_SZ ExecutionPolicy</CommandLine>
|
||||
<CommandLine>reg add HKLM\Software\Policies\Microsoft\Windows\Powershell /v ExecutionPolicy /t REG_SZ /d Unrestricted</CommandLine>
|
||||
<RequiresUserInput>false</RequiresUserInput>
|
||||
</SynchronousCommand>
|
||||
<SynchronousCommand wcm:action="add">
|
||||
<Description>Allow Scripts</Description>
|
||||
<Order>3</Order>
|
||||
<CommandLine>reg add HKLM\Software\Policies\Microsoft\Windows\Powershell /v 1 /t REG_DWORD EnableScripts</CommandLine>
|
||||
<CommandLine>reg add HKLM\Software\Policies\Microsoft\Windows\Powershell /v EnableScripts /t REG_DWORD /d 1</CommandLine>
|
||||
<RequiresUserInput>false</RequiresUserInput>
|
||||
</SynchronousCommand>
|
||||
<SynchronousCommand wcm:action="add">
|
||||
|
1
cert.bat
Normal file
1
cert.bat
Normal file
@ -0,0 +1 @@
|
||||
certutil -addstore -f "TrustedPublisher" C:\ProgramData\Easy-GPU-P\parsecpublic.cer
|
Loading…
Reference in New Issue
Block a user