fabianosrc / TermsrvPatcher

Patch termsrv.dll so that multiple remote users can open an RDP session on a non-Windows Server computer
MIT License
101 stars 21 forks source link

Copy-Item fails termsrv.dll file in use #4

Closed leleb closed 7 months ago

leleb commented 9 months ago

although TermService stopped (and dependant UmRdpService toot) for some reason the termsrv.dll file keeps being loked for a while (about 2 minutes) and Copy-Item fails. thus need to do some retry. replace lines: Copy-Item -Path $termsrvPatched -Destination $termsrvDllFile -Force with: Stop-Service -Name TermService -Force for($i=1; $i -le 100; $i++) { Write-Host Replacement retry: $i of 100 Start-Sleep -Milliseconds 2000 $error.Clear() Copy-Item -Path $termsrvPatched -Destination $termsrvDllFile -Force if($error.Count -eq 0) { $i=100 Write-Host 'Replacement successfull!' -ForegroundColor Green } }

fabianosrc commented 9 months ago

Hi @leleb, thanks for your contribution. I will be implementing these improvements in the script.