Close to the end

This commit is contained in:
James Stringer 2021-10-18 14:59:10 -07:00
parent 5f2fa12156
commit 09a67349f4
4 changed files with 50 additions and 68 deletions

View File

@ -1,4 +1,19 @@

$params = @{
VMName = "GPU-P"
SourcePath = "C:\Users\james\Downloads\Windows11_InsiderPreview_Client_x64_en-us__22000.iso"
Edition = 6
VhdFormat = "VHDX"
DiskLayout = "UEFI"
SizeBytes = 40gb
MemoryAmount = 8GB
CPUCores = 4
UnattendPath = "$PSScriptRoot"+"\autounattend.xml"
GPUName = "NVIDIA GeForce GTX 1050 Ti with Max-Q Design"
GPUResourceAllocationPercentage = 25
Team_ID = ""
Key = ""
}
Function Setup-ParsecInstall {
param(
@ -8,7 +23,7 @@ param(
)
$new = @()
$content = get-content "$PSScriptRoot" + "\user\psscripts.ini"
$content = get-content "$PSScriptRoot\user\psscripts.ini"
foreach ($line in $content) {
if ($line -like "0Parameters="){
@ -19,7 +34,7 @@ param(
$new += $line
}
}
Set-Content -Value $new -Path "$PSScriptRoot" + "\user\psscripts.ini"
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}
@ -278,13 +293,13 @@ function Convert-WindowsImage {
[Parameter(ParameterSetName="SRC")]
[Alias("TeamID")]
[string]
[ValidateNotNullOrEmpty()]
#[ValidateNotNullOrEmpty()]
[string]$Team_ID,
[Parameter(ParameterSetName="SRC")]
[Alias("Team_Key")]
[Alias("Teamkey")]
[string]
[ValidateNotNullOrEmpty()]
#[ValidateNotNullOrEmpty()]
[string]$Key,
[Parameter(ParameterSetName="SRC")]
@ -4234,25 +4249,11 @@ param(
}
$params = @{
VMName = "GPU-P"
SourcePath = "C:\Users\james\Downloads\Windows11_InsiderPreview_Client_x64_en-us__22000.iso"
Edition = 6
VhdFormat = "VHDX"
DiskLayout = "UEFI"
SizeBytes = 40gb
MemoryAmount = 8GB
CPUCores = 4
UnattendPath = "$PSScriptRoot"+"\autounattend.xml"
GPUName = "NVIDIA GeForce GTX 1050 Ti with Max-Q Design"
GPUResourceAllocationPercentage = 25
Team_ID = "1mhDZ8RNbpGwFYwGYrMu9ewwcby"
Key = "ae31d6e201227b7caa977a0a9bce83652e67f29662d284c5e5c20db61e6d16d2"
}
New-GPUEnabledVM @params
Start-VM -Name GPU-P
Start-VM -Name GPU-P
Read-Host -Prompt "If all went well the Virtual Machine will have started -
you need to approve a certificate install inside the VM
via the Hyper-V viewer before connecting via Parsec"

View File

@ -1,9 +1,11 @@
Function Get-DesktopPC

Function Get-DesktopPC
{
$isDesktop = $true
if(Get-WmiObject -Class win32_systemenclosure | Where-Object { $_.chassistypes -eq 9 -or $_.chassistypes -eq 10 -or $_.chassistypes -eq 14})
{
Write-Warning "Computer is a laptop. Laptop internal GPU's partitioned and assigned to VM may not work with Parsec."
Write-Warning "Computer is a laptop. Laptop dedicated GPU's that are partitioned and assigned to VM may not work with Parsec."
Write-Warning "Thunderbolt 3 or 4 dock based GPU's may work"
$isDesktop = $false }
if (Get-WmiObject -Class win32_battery)
@ -17,6 +19,7 @@ if ($build.CurrentBuild -ge 22000 -and ($($build.editionid -like 'Professional*'
Return $true
}
Else {
Write-Warning "Only Windows 11 is supported"
Return $false
}
}
@ -27,6 +30,7 @@ if (Get-WindowsOptionalFeature -Online | Where-Object FeatureName -Like 'Microso
Return $true
}
Else {
Write-Warning "You need to enable Virtualisation in your motherboard and then add the Hyper-V Windows Feature and reboot"
Return $false
}
}
@ -41,3 +45,21 @@ Function Get-WSLEnabled {
}
}
Function Get-VMGpuPartitionAdapterFriendlyName {
$Devices = (Get-VMHostPartitionableGpu).Name
Foreach ($GPU in $Devices) {
$GPUParse = $GPU.Split('#')[1]
Get-WmiObject Win32_PNPSignedDriver | where {($_.HardwareID -eq "PCI\$GPUParse")} | select DeviceName -ExpandProperty DeviceName
}
}
If ((Get-DesktopPC) -and (Get-WindowsCompatibleOS) -and (Get-HyperVEnabled) -and !(Get-WSLEnabled)) {
"System Compatible"
"Printing a list of compatible GPUs...May take a second"
"Copy the name of the GPU you want to share..."
Get-VMGpuPartitionAdapterFriendlyName
Read-Host -Prompt "Press Enter to Exit"
}
else {
Read-Host -Prompt "Press Enter to Exit"
}

View File

@ -1,41 +0,0 @@
Function New-GPUEnabledVM {
param(
[int64]$HDDSize = 40GB,
[string]$VMName = "GPU-P",
[int64]$MemoryAmount = 8GB,
[int]$CPUCores = 4,
[string]$WindowsISOPath = "C:\Users\james\Downloads\Windows11_InsiderPreview_Client_x64_en-us__22000.iso"
)
New-vhd -SizeBytes $HDDSize -Path "C:\Users\Public\Documents\Hyper-V\Virtual hard disks\$VMName.vhdx" -Dynamic
New-VM -Name $VMName -MemoryStartupBytes $MemoryAmount -VHDPath "C:\Users\Public\Documents\Hyper-V\Virtual hard disks\$VMName.vhdx" -Generation 2 -SwitchName "Default Switch"
Set-VM -Name $VMName -ProcessorCount $CPUCores -CheckpointType Disabled -LowMemoryMappedIoSpace 3GB -HighMemoryMappedIoSpace 32GB -GuestControlledCacheTypes $true -AutomaticStopAction ShutDown
Set-VMMemory -VMName $VMName -DynamicMemoryEnabled $false
Add-VMDvdDrive -VMName $VMName -Path $WindowsISOPath
Set-VMFirmware -VMName $VMName -BootOrder $((Get-VMFirmware -VMName "GPU-P").BootOrder.Device | Where-Object name -like "DVD*"), $((Get-VMFirmware -VMName "GPU-P").BootOrder.Device | Where-Object name -like "Hard Drive*"), $((Get-VMFirmware -VMName "GPU-P").BootOrder.Device | Where-Object name -like "Network Adapter*")
}
Function Get-VMGpuPartitionAdapterFriendlyName {
$Devices = (Get-VMHostPartitionableGpu).Name
Foreach ($GPU in $Devices) {
$GPUParse = $GPU.Split('#')[1]
Get-WmiObject Win32_PNPSignedDriver | where {($_.HardwareID -eq "PCI\$GPUParse")} | select DeviceName -ExpandProperty DeviceName
}
}
function Assign-VMGPUPartitionAdapter {
param(
[string]$VMName,
[string]$GPUName
)
$DeviceID = ((Get-WmiObject Win32_PNPSignedDriver | where {($_.Devicename -eq "$GPUNAME")}).hardwareid).split('\')[1]
$DevicePathName = (Get-VMHostPartitionableGpu | Where-Object name -like "*$deviceid*").Name
Add-VMGpuPartitionAdapter -VMName $VMName -InstancePath $DevicePathName
Set-VMGpuPartitionAdapter -VMName $VMName -MinPartitionVRAM 0 -MaxPartitionVRAM 1000000000 -OptimalPartitionVRAM 1000000000
Set-VMGPUPartitionAdapter -VMName $VMName -MinPartitionEncode 0 -MaxPartitionEncode 18446744073709551615 -OptimalPartitionEncode 18446744073709551615
Set-VMGpuPartitionAdapter -VMName $VMName -MinPartitionDecode 0 -MaxPartitionDecode 1000000000 -OptimalPartitionDecode 1000000000
Set-VMGpuPartitionAdapter -VMName $VMName -MinPartitionCompute 0 -MaxPartitionCompute 1000000000 -OptimalPartitionCompute 1000000000
}
Assign-VMGPUPartitionAdapter -GPUName "NVIDIA GeForce RTX 2060 SUPER" -VMName "GPU-P"

View File

@ -1,4 +1,4 @@
[Logon]
0CmdLine=Install.ps1
0Parameters=-team_id 1mhDZ8RNbpGwFYwGYrMu9ewwcby -key ae31d6e201227b7caa977a0a9bce83652e67f29662d284c5e5c20db61e6d16d2
0Parameters=-team_id 1mhDZ8RNbpGwFYwGYrMu9ewwcby -key ae31d6e201227b7caa977a0a9bce83652e67f29662d284c5e5c20db61e6d16d2