![]() |
|
|
By: Aaron Nelson | Read Comments (4) | Print Aaron is a Senior SQL Server Architect with over 10 years experience in architecture, BI, development and tuning. Related Tips: More |
|
A Community Technology Preview (CTP) is a great thing. It allows you to explore an upcoming release and gives you an opportunity to provide early feedback to the development team. CTP3 for the next edition of SQL Server, code-named Denali, was recently released. Now, before you go installing this on a critical server for evaluation, you might think about the risks involved with a CTP. It's not production-ready. It's still being tested. It might crash. So, the best and easiest way to run your current version of SQL Server and Denali at the same time is to use a Virtual Machine. Microsoft has recognized that this approach is a solid one, and has done us all the favor of creating a Hyper-V image of SQL Server Denali CTP3 at http://www.microsoft.com/download/en/details.aspx?id=27740.
The only problem with the implementation of this idea is that the VM image is split into 36 individual files to "simplify the download". I don’t know about you, but the last thing I want to do with my day is download each individual file manually.
Enter PowerShell. As some of you may remember, I published a script to download the MCM Videos that the good folks at SQLskills.com put together a while back. Here, we'll be using the same concept and much of the same code to download all 36 pieces of the Hyper-V image of Denali CTP3. However, this version has been enhanced to leverage the BITS built into Windows 7. Note: If you’re on XP, I'm sorry but this script probably isn't going to work for you. If you desperately want an XP version, let me know and I'll see what I can do.
First, the script will download the text of the page. Then, it will read the entire download page, looking for a common RegEx match on file name. In this case, it's looking for "SQLServerCodeNameDenaliCTP3". If you download the PowerShell script, you'll see this being set to a variable named $FindThis.
One nice piece of functionality, considering the size of the download, is that the script will check to see if the file already exists. If you're looking at the script, look for: if ((Test-Path $file) -eq "true"). This is testing to see if the contents of the $file variable already exist. If so, it'll skip over it, meaning you can stop and restart this download. Also, there will be two progress windows when you execute the script. The first is a progress bar for the file that is downloading, inspired by and heavily borrowed from PowerShell MVP Marco Shaw's ( blog | twitter ) fabulous script for downloading the videos from TechEd. The second progress bar gives overall progress, telling you which file you're downloading.

To run this script launch PowerShell ISE and copy the PowerShell script from below or download it here. Then paste it into a PowerShell window and press F5 to execute the script and the download will begin. Note that the default folder for the download is "C:\temp\", but this can be changed in the script if needed.
$Feed = (new-object net.webclient).DownloadString(“http://www.microsoft.com/download/en/details.aspx?id=27740”) $regex = "http://download.microsoft.com/download/./././[0-f]{8}-[0-f]{4}-[0-f]{4}-[0-f]{4}-[0-f]{12}/SQLServerCodeNameDenaliCTP3.part[0-9]{2}[^>]*?(rar|exe)" $MatchResults=[regex]::Matches($Feed, "$regex") $FileNamesFound = $MatchResults | % { $_.Value } Import-Module -Name BitsTransfer $script:total_sessions = $Null; foreach($session in $($FileNamesFound)) { $script:total_sessions++ } $script:current_session=1 $FindThis = "SQLServerCodeNameDenaliCTP3" foreach($Vidlnk in $FileNamesFound) { Write-Progress -Activity "Overall progress" -Status $([string]$script:current_session+" of "+[string]$script:total_sessions) -PercentComplete $((${script:current_session}/$script:total_sessions)*100) $FileSplit=$Vidlnk -Split "$FindThis" $VideoName="$FindThis$($FileSplit[1])" $file="C:\temp\$VideoName" "Checking to see if $file has already been downloaded"; if ((Test-Path $file) -eq "true") {"$file is already there mate"} else { "Downloading $file" Start-BitsTransfer -Source $Vidlnk -Destination $file } $script:current_session++ }
Once you get all of the files downloaded, you'll still need to reconstitute the Virtual Machine. Look to the instructions at the bottom of the download page to get some guidance there.
Now, this is a pretty quick and dirty script. I hope that it helps you download the image of Denali CTP3 more efficiently, but I'm also going to throw out the standard caveat. No guarantees, no refunds, no returns. Enjoy!
| Share: | Share | Tweet |
|
![]() |
![]() |
Free SQL Server Learning |
| Wednesday, November 02, 2011 - 10:42:10 AM - John Holt |
|
|
Good PS script. It looks like this would really be a pain without it. |
|
| Tuesday, February 21, 2012 - 2:16:10 PM - mssqldude |
|
|
You'll need your scripts again if you want to go and download the new SQL Server 2012 RC0 set of industry BI demos which Microsoft just published with 42 compressed files: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=28802 |
|
|
privacy | disclaimer | copyright | advertise | about authors | contribute | feedback | giveaways | user groups Some names and products listed are the registered trademarks of their respective owners. Edgewood Solutions LLC | MSSharePointTips.com | MSSQLTips.com |