Closed leleb closed 7 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 } }
Copy-Item -Path $termsrvPatched -Destination $termsrvDllFile -Force
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 } }
Hi @leleb, thanks for your contribution. I will be implementing these improvements in the script.
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 } }