Home > download script, learning, powershell, sql, SQLServerPedia Syndication > Download the MCM Readiness Videos with PowerShell: Now with BITS

Download the MCM Readiness Videos with PowerShell: Now with BITS

I was playing around with BITS transferring backups between servers and discovered that BITS has PowerShell cmdlets. I was previously using the BITSAdmin Tool which was easy, but I wanted to find out more about the PoSh cmdlets. After reading the docs, I decided to use these cmdlets in my MCM video download script.

BITS stands for Background Intelligent Transfer Service. It is a service built into windows since XP designed to transfer files in the background without interrupting normal user network usage. Windows Update uses BITS to download all the patches that need to be applied to your computer. As stated above, you too can also use BITS to transfer files around. If you regularly transfer large files over the network and get annoyed by how it affects your computer experience, look into replacing the normal copy, xcopy, robocopy commands with it.

My first attempt queued all the files into one BITS transfer. The upside is only one BITS job to manage. The downside is the filenames aren’t written until the whole job completes. Long download jobs often get cancelled and the user would want to be able to listen to or watch the files that had already finished. I wanted the opposite, so I went for one job per file.

The BITS cmdlets require PowerShell v2.0

Download the script

  1. Meher
    January 3rd, 2011 at 18:14 | #1

    Hi Eric,

    Can you please post some instructions on how to run the script. I ran it at the PS Command prompt but every time I run it I get errors and the window disapperas. I have downloaded the Agility pack. I think I must be doing something wrong. If you can post some instructions on how to run the script, that would be great.

    Thank you very much,

    Meher

    • January 3rd, 2011 at 19:29 | #2

      Meher, you might want to look at my first PowerShell post first. You’ll likely have to edit two lines. The first being where the HtmlAgilityPack dll resides. And the second being where to save the videos. $env:public refers to the Public folder in Vista / Win7. Not sure if it works in XP. The $env:userprofile refers to your user profile directory.

      Also, by default, it doesn’t download, it only prints the urls that it will download. You’ll need to specify the -download argument on the command line.

  1. No trackbacks yet.

%d bloggers like this: