DesktopECHO / Pi-Hole-for-WSL1

Ad-blocking DNS server for Windows • Unbound pre-configured • Deployment ready in minutes • Does not require hypervisor/docker
364 stars 54 forks source link

Install script - Start-BitsTransfer never completes - requires same admin login (not just run-as) #124

Closed JamminR closed 7 hours ago

JamminR commented 1 month ago

Though the PH4WSL1.CMD script will start and attempt commands if 'Run as administrator" is selected, the download of Debian will never complete if the user logged into (Windows 10 Pro, in my case) using different account than the admin account the script is run as. It would get stuck at Downloading the debian - first download. I've spent the past 2 hours trying to determine why my BITS list had 17000+ suspended entries and was growing while my command window was open and script running/stuck at the download. I was logging into my Win10 pro box as a standard user, then running the CMD installer as admin as directed in steps. Once i disconnected from the user session and logged in as the admin account and re-ran, it worked well.

I believe root cause is due to the "Important!" notice at the -BitsTransfer Microsoft Learn page https://learn.microsoft.com/en-us/windows/win32/bits/using-windows-powershell-to-create-bits-transfer-jobs#to-create-a-synchronous-bits-transfer-job "When you use *-BitsTransfer cmdlets from within a process that runs in a noninteractive context, such as a Windows service, you may not be able to add files to BITS jobs, which can result in a suspended state. For the job to proceed, the identity that was used to create a transfer job must be logged on."

DesktopECHO commented 7 hours ago

When v6 is released upstream, I'll see what I can do to improve the installer's behaviour for non-admin users who need to run as a different user with admin rights.