SBS 2008, Windows Update and BITS

Just following on from my last post about SBS 2008 setup hanging while expanding and installing files.

I mentioned in the last post that since it appeared to be Windows Update causing the problem I was hoping the update got stuck would be downloaded again when I manually ran the updates.

So I started the update process and got exactly the same thing.

The progress bar sat doing nothing for ages, simply telling me it was “downloading updates”.

I mentioned in the last post that I’d forgot to the use the /ALLUSERS switch with BITSADMIN so I may have missed queued jobs. Turns out i was right. This time there was a number of jobs listed and as they were getting downloaded they started to drop off the list until I was left with job three or four jobs.

The byte count on these jobs didn’t appear to be changing so it looked like the jobs were stuck so my first port of call was to restart the BITS service.

This seemed to have some effect as the byte counts started to go up again.

However, even when the downloaded byte count matched the file size byte count the jobs were still displayed.

Each jobs status was set to “transferred “ but didn’t look like it was going anywhere.

I found this helpful post on the lifecycle of a BITS job which says

The job moves between the queued, connecting, and transferring states until BITS transfers all files in the job. At that point, the job moves to the transferred state. BITS uses round-robin scheduling to schedule jobs that are at the same priority level. Each job is given a slice of time to process its files. If the job does not complete during its time slice, the job goes back to the queued state and the next job in the queue is activated. This prevents large jobs from blocking smaller jobs. Jobs are processed largely on a first in, first out (FIFO) basis; however, BITS cannot guarantee FIFO processing because of round-robin scheduling, job errors, and service restarts.

So for some reason the job wasn’t reaching the “complete” stage.

I initially didn’t think this would be a problem as BITSADMIN has the /COMPLETE flag but when I ran it I was given an access denied error.

The penny dropped then and I realised why I hadn’t seen the jobs until I used the /ALLUSERS flag. The job owner was set to the system account so even though I was logged in as the administrator I couldn’t make changes to the job.

Once again I thought BITSADMIN would come to my rescue as there is a “/TAKEOWNERSHIP” flag. My optimism was short-lived though I got the access denied message again.

So my dilemma was that I needed to mark the job as complete while being logged in as the system account. How was I going to do that?

Then I remembered one way of getting something to run under the context of the system account

Scheduled Tasks!

I setup a batch file with a single command for each listed job

BITSADMIN /COMPLETE <job number>

Then I set it as a scheduled task to run in a few minutes time.

Once that was complete both of my jobs disappeared from the job queue and my windows update completed as normal.

I’m still at a bit of a loss as to why the jobs were stuck in the first place but I’m just happy it worked in the end!

A full list of the BITSADMIN switches are here

The following two tabs change content below.
Andy Parkes is Technical Director at Coventry based IT support company IBIT Solutions. Formerly, coordinator of AMITPRO and Microsoft Partner Area Lead for 2012-2013. He also isn't a fan of describing himself in the third person.

Latest posts by Andy Parkes (see all)

1 thought on “SBS 2008, Windows Update and BITS

Leave a Reply