# Step 1: Elevate to admin permissions if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs exit } # Step 2: Check for DCV Server installation $dcvPath = (Get-CimInstance Win32_Service -Filter 'Name = "dcvserver"').PathName if (-not $dcvPath) { $installDCV = Read-Host -Prompt 'NICE DCV Server not found. Would you like to install it? (y/n)' if ($installDCV -eq 'y') { $msiPath = "$($env:TEMP)\nice-dcv-server-x64-Release-2023.0-14852.msi" Invoke-WebRequest -Uri 'https://files.polloloco.de/share/nice-dcv-server-x64-Release-2023.0-14852.msi' -OutFile $msiPath Start-Process 'msiexec.exe' -ArgumentList "/i `"$msiPath`" /qn /norestart" -Wait $dcvPath = (Get-CimInstance Win32_Service -Filter 'Name = "dcvserver"').PathName if (-not $dcvPath) { Write-Host 'Unable to find NICE DCV Server after installation. Please try installing manually and re-running this script.' -ForegroundColor Red Read-Host -Prompt 'Press Enter to exit' exit } } else { Write-Host 'NICE DCV Server not found. Exiting script.' -ForegroundColor Red Read-Host -Prompt 'Press Enter to exit' exit } } Write-Host 'NICE DCV Server is installed. Downloading bypass...' $parentFolder = Split-Path -Path $dcvPath -Parent $parentFolder = $parentFolder.TrimStart('"') # Step 3: Check for rlm_real.dll and rename rlm.dll if necessary if (Test-Path "$parentFolder\rlm_real.dll") { Rename-Item -Path "$parentFolder\rlm.dll" -NewName 'rlm_temp.dll' -ErrorAction SilentlyContinue } else { Rename-Item -Path "$parentFolder\rlm.dll" -NewName 'rlm_real.dll' -ErrorAction SilentlyContinue } # Step 4: Download rlm.dll from Polloloco.de and save to PathDCV Invoke-WebRequest -Uri 'https://files.polloloco.de/share/rlm.dll' -OutFile "$parentFolder\rlm.dll" # Step 4.1 Check if the registry parameter HKEY_USERS/S-1-5-18/Software/GSettings/com/nicesoftware/dcv/connectivity/enable-quic-frontend exists $regPath = "HKU\S-1-5-18\Software\GSettings\com\nicesoftware\dcv\connectivity" if (!(Test-Path "Registry::$regPath\enable-quic-frontend")) { # Create the registry parameter with a value of 1 New-ItemProperty -Path "Registry::$regPath" -Name "enable-quic-frontend" -Value 1 -PropertyType "DWord" -Force Write-Host 'Enabled QUIC support' } elseif ((Get-ItemProperty -Path "Registry::$regPath" -Name "enable-quic-frontend")."enable-quic-frontend" -eq 0) { # If the registry parameter exists and has a value of 0, do nothing and continue Write-Host 'QUIC seems to be disabled in the registry' Write-Host "The registry parameter 'enable-quic-frontend' exists but its value is 0. Continuing with the script..." } # Step 5: Prompt user to restart DCV Server Write-Host 'Please restart the NICE DCV Server service to apply changes.' -ForegroundColor Yellow Read-Host -Prompt 'Press Enter to continue' # Step 6: Restart the dcvserver service Restart-Service -Name 'dcvserver' # Step 7: Wait for dcvserver service to restart do { Start-Sleep -Seconds 1 } while ((Get-Service -Name 'dcvserver').Status -ne 'Running') # Step 8: Prompt user to exit Write-Host 'NICE DCV Server has been restarted. Please exit this script.' -ForegroundColor Green Read-Host -Prompt 'Press Enter to exit' # Step 9: Delete rlm_temp.dll if it exists if (Test-Path "$parentFolder\rlm_temp.dll") { Remove-Item -Path "$parentFolder\rlm_temp.dll" -Force }