While troubleshooting a client that intermittently was reporting Waiting for content back to ConfigMgr, I found that the BITS transfer queue had gone total bananas. In this scenario I was pushing a firewall configuration to a number of clients for testing before the big roll out. At first I thought that there were some boundary issues, but that was not the issue. While looking at the execmgr.log file, I could definitely see that the client was waiting for the content to be downloaded.

Since this was a server running Windows Server 2012, I had access to the really great PowerShell cmdlet called:

Get-BitsTransfer

With this excellent cmdlet, it’s really easy to see all the BITS transfers that are currently in progress. Now, the ConfigMgr client is running as the Local System account. Therefor in order to see BITS transfers from the ConfigMgr client we have to run the following command:

Get-BitsTransfer -AllUsers

When I executed this command, it became clear to me why the client was reporting Waiting for content. As you can see in the picture below, there where definitely an issue with BITS and for some reason it had failed to download a bunch of jobs and many where queued up.

87_1

Since BITS uses a round robin like method to try and resume those transfers that had a temporary error (transient error), I didn’t want to wait for that complete. Instead I decided to reset the BITS transfer queue on the client in this case. You can do this by either going at it a single job at a time, or actually remove the whole queue completely. You could of course use PowerShell to only remove the jobs that are in a failed state, if you want to go with that method, this one-liner should be enough:

Get-BitsTransfer -AllUsers | Where-Object { $_.JobState -like "TransientError" } | Remove-BitsTransfer

But as I said, I needed to see if the firewall configuration was working, and therefor I decided to remove the whole queue completely. This can be accomplished by running a batch script. Why a batch script? Well, it will work on systems where the Get-BitsTransfer cmdlet is not available. Here’s the batch file that I created:

@echo off
net stop BITS
ipconfig /flushdns
ren "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr0.dat" qmgr0.dat.old
ren "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr1.dat" qmgr1.dat.old
net start BITS

I saved the above batch script to a .bat file and ran it from an elevated command prompt. I then checked the BITS transfer queue again by running:

Get-BitsTransfer -AllUsers

The BITS transfer queue was now empty. After that I re-deployed the firewall configuration package to the client and it was now downloaded successfully by BITS.

Nickolaj Andersen
Principal Consultant and Enterprise Mobility MVP. Nickolaj has been in the IT industry for the past 10 years specializing in Enterprise Mobility and Security, Windows deployments and Automation. In 2015 Nickolaj was awarded as PowerShell Hero by the community for his script and tools contributions. Author of ConfigMgr Prerequisites Tool, ConfigMgr OSD FrontEnd, ConfigMgr WebService and a frequent speaker at user groups.

(3441)

comments
  • Vinod
    Posted at 18:13 April 25, 2016
    Vinod
    Reply
    Author

    Hi,
    I tried the above steps, but i still getting error again and again. I am lost now. What else can be checked in ?

    • chai walla
      Posted at 21:08 July 8, 2016
      chai walla
      Reply
      Author

      Vinod, reboot and get chai from the chai dukan across the street.

  • Rajeev
    Posted at 13:21 August 18, 2016
    Rajeev
    Reply
    Author

    It works !!

  • Andy
    Posted at 18:23 January 18, 2017
    Andy
    Reply
    Author

    It works. Thanks

  • Duncan Parrott
    Posted at 14:23 February 14, 2017
    Duncan Parrott
    Reply
    Author

    Hi, I have the same problem, tried the batch file, but i keep getting access denied, please help?

  • Leave a Reply