Write-Host "[OK] RDP Wrapper installation detected." -ForegroundColor Green Write-Host "[INFO] Stopping Remote Desktop Services..." -ForegroundColor Yellow Stop-Service TermService -Force -ErrorAction SilentlyContinue Stop-Service UmRdpService -Force -ErrorAction SilentlyContinue Step 3: Check termsrv.dll permissions (common "Access Denied" fix) Write-Host "[CHECK] termsrv.dll permissions..." -ForegroundColor Yellow $acl = Get-Acl $TermsrvPath $rule = $acl.Access | Where-Object $_.IdentityReference -eq "NT SERVICE\TermService" if (-not $rule) Write-Host "[FIX] Adding TermService permission to termsrv.dll" -ForegroundColor Green $rule = New-Object System.Security.AccessControl.FileSystemAccessRule("NT SERVICE\TermService", "ReadAndExecute", "Allow") $acl.AddAccessRule($rule) Set-Acl $TermsrvPath $acl else Write-Host "[OK] TermService permissions correct." -ForegroundColor Green Step 4: Backup and replace rdpwrap.ini with latest version Write-Host "[CHECK] rdpwrap.ini version..." -ForegroundColor Yellow $backupIni = "$RDPWrapperPath\rdpwrap.ini.backup" if (Test-Path $RDPWrapIni) Copy-Item $RDPWrapIni $backupIni -Force Write-Host "[BACKUP] Saved old rdpwrap.ini to $backupIni" -ForegroundColor Cyan Download latest rdpwrap.ini from GitHub (if internet available) $latestIniUrl = "https://raw.githubusercontent.com/sebaxakerhtc/rdpwrap.ini/master/rdpwrap.ini" try Invoke-WebRequest -Uri $latestIniUrl -OutFile "$env:TEMP\rdpwrap_new.ini" -ErrorAction Stop Copy-Item "$env:TEMP\rdpwrap_new.ini" $RDPWrapIni -Force Write-Host "[UPDATE] Downloaded latest rdpwrap.ini" -ForegroundColor Green catch Write-Host "[WARN] Could not download latest rdpwrap.ini. Using existing." -ForegroundColor Yellow Step 5: Re-register RDP Wrapper components Write-Host "[FIX] Reinstalling RDP Wrapper service..." -ForegroundColor Yellow & "$RDPWrapperPath\install.bat" -Force -Silent 2>&1 | Out-Null Step 6: Restart services Write-Host "[INFO] Restarting Remote Desktop Services..." -ForegroundColor Yellow Start-Service TermService -ErrorAction SilentlyContinue Start-Service UmRdpService -ErrorAction SilentlyContinue Step 7: Verify status Start-Sleep -Seconds 3 $termStatus = (Get-Service TermService).Status $umrpStatus = (Get-Service UmRdpService).Status
if ($RestartService) Restart-Computer -Force
Write-Host "`n[INFO] If you still see 'Access Denied':" -ForegroundColor Yellow Write-Host "1. Disable Windows Defender Real-time protection temporarily" -ForegroundColor Gray Write-Host "2. Add exclusion for $RDPWrapperPath in antivirus" -ForegroundColor Gray Write-Host "3. Reboot and run this tool again" -ForegroundColor Gray
Rdp Wrapper Access - Denied
Write-Host "[OK] RDP Wrapper installation detected." -ForegroundColor Green Write-Host "[INFO] Stopping Remote Desktop Services..." -ForegroundColor Yellow Stop-Service TermService -Force -ErrorAction SilentlyContinue Stop-Service UmRdpService -Force -ErrorAction SilentlyContinue Step 3: Check termsrv.dll permissions (common "Access Denied" fix) Write-Host "[CHECK] termsrv.dll permissions..." -ForegroundColor Yellow $acl = Get-Acl $TermsrvPath $rule = $acl.Access | Where-Object $_.IdentityReference -eq "NT SERVICE\TermService" if (-not $rule) Write-Host "[FIX] Adding TermService permission to termsrv.dll" -ForegroundColor Green $rule = New-Object System.Security.AccessControl.FileSystemAccessRule("NT SERVICE\TermService", "ReadAndExecute", "Allow") $acl.AddAccessRule($rule) Set-Acl $TermsrvPath $acl else Write-Host "[OK] TermService permissions correct." -ForegroundColor Green Step 4: Backup and replace rdpwrap.ini with latest version Write-Host "[CHECK] rdpwrap.ini version..." -ForegroundColor Yellow $backupIni = "$RDPWrapperPath\rdpwrap.ini.backup" if (Test-Path $RDPWrapIni) Copy-Item $RDPWrapIni $backupIni -Force Write-Host "[BACKUP] Saved old rdpwrap.ini to $backupIni" -ForegroundColor Cyan Download latest rdpwrap.ini from GitHub (if internet available) $latestIniUrl = "https://raw.githubusercontent.com/sebaxakerhtc/rdpwrap.ini/master/rdpwrap.ini" try Invoke-WebRequest -Uri $latestIniUrl -OutFile "$env:TEMP\rdpwrap_new.ini" -ErrorAction Stop Copy-Item "$env:TEMP\rdpwrap_new.ini" $RDPWrapIni -Force Write-Host "[UPDATE] Downloaded latest rdpwrap.ini" -ForegroundColor Green catch Write-Host "[WARN] Could not download latest rdpwrap.ini. Using existing." -ForegroundColor Yellow Step 5: Re-register RDP Wrapper components Write-Host "[FIX] Reinstalling RDP Wrapper service..." -ForegroundColor Yellow & "$RDPWrapperPath\install.bat" -Force -Silent 2>&1 | Out-Null Step 6: Restart services Write-Host "[INFO] Restarting Remote Desktop Services..." -ForegroundColor Yellow Start-Service TermService -ErrorAction SilentlyContinue Start-Service UmRdpService -ErrorAction SilentlyContinue Step 7: Verify status Start-Sleep -Seconds 3 $termStatus = (Get-Service TermService).Status $umrpStatus = (Get-Service UmRdpService).Status
if ($RestartService) Restart-Computer -Force
Write-Host "`n[INFO] If you still see 'Access Denied':" -ForegroundColor Yellow Write-Host "1. Disable Windows Defender Real-time protection temporarily" -ForegroundColor Gray Write-Host "2. Add exclusion for $RDPWrapperPath in antivirus" -ForegroundColor Gray Write-Host "3. Reboot and run this tool again" -ForegroundColor Gray