Create ISO of Cumulative Update with PowerShell – Overview

 

As you know, Microsoft is releasing a Cumulative Update (CU) about every month now. Even NAV2015 has its 7th CU.

A CU is actually always a complete product cd, with the latest binaries (aka Platform Update, aka build) and the latest application version (aka objects) as database. When you implement the application changes, it is best practice to upgrade your build as well.

The era of burning DVD’s and putting them in servers to be able to install is over. We work with images. ISO-files, if you will :-). So, what I’m personally doing all the time is creating an ISO of the download the we get, to be able to use in VM’s, to mount in Win8, in Windows Server, in VMWare or Hyper-V, in whatever.. . Bottom line: Microsoft provides us an exe (which is actually a self-extractable zip).. and we need an ISO!

So the big question is: how can I automate to create an ISO out of this bloody EXE.

You want to automate? Well .. did you ever hear about PowerShell? :-). To be honest, there is not one thing that I haven’t been able to do with PowerShell .. I love the damn tool! :-). Now, this was quite a challenge though .. So I’m posting my solution in a few steps.

  1. Unzip de CU. The CU is always a self-extractable zipfile, with within that zip file, a folder with the updated application objects, and yet another zip file with the updated product DVD. We are interested in that product DVD, because it’s THAT one that is going to have to be put into an ISO file.
  2. Get VersionInfo from the downloaded Cumulative Update file. Microsoft applies a naming convention which we can use to create some kind of versioning info. This way, I will be able to automatically create a naming convention for my resulting ISO image. To determine this “versioninfo”, I created a separate function.
  3. Create the ISO. When everything is unzipped, and I have all version info, I’m able to create the ISO. For this, yet another function has been created.

 

I will update this post so you will get the links above, and easily find the references that are necessary for this combination of scripts and functions to work .. I hope.. . In the end, a script like this will combine and automate the entire process: converting your exe (your exact Cumulative Update download) to an ISO:

 

$ZipFIle = 'C:\$Installs\481951_NLB_i386_zip.exe'
$TmpLocation = 'C:\Temp'
$IsoDirectory = 'C:\$Installs\'

#Load all my functions in this runspace
Get-ChildItem -path (Join-Path $PSScriptRoot '..\PSFunctions\*.ps1') | foreach { . $_.FullName}

#Create Templocation is if doesn't exist yet
IF (Test-Path $TmpLocation){
    if ((Read-Host -Prompt "$TmpLocation already exists. Remove? (y/n)") -ieq 'y') {
       Remove-Item $TmpLocation -Recurse -Force 
    } else {
       Write-Host "Operation aborted."
       break
    }  
}
New-Item -ItemType directory -Path $TmpLocation 

#Unzip the CU
$DVDPath = Unzip-NAVCumulativeUpdateDownload -SourcePath $ZipFIle -DestinationPath $TmpLocation 

#Get Version info from the zipfile
$VersionInfo = Get-NAVCumulativeUpdateDownloadVersionInfo -SourcePath $ZipFIle

#Create the ISO
$ISOName = $VersionInfo.FullVersionString
$IsoFileName = Join-Path $ISODirectory "$ISOName.iso"
New-ISOFileFromFolder -FilePath $DVDPath -Name $ISOName -ResultFullFileName $IsoFileName

 

The script is quite basic:

  • Load all my functions in a certain folder
  • Create the temp-folder (where I’m going to unzip the files), if it exists, ask to delete it, if not, abort the script execution
  • Unzip: for this, I created a new function “Unzip-NAVCumulativeUpdateDownload”
  • Get Version Info: for this, I created a new function “Get-NAVCumulativeUpdateDownloadVersionInfo” (I know, quite a long name – i’m sure you’ll be able to come up with better names)
  • Create the ISO: for this, I created a new function “New-ISOFileFromFolder”

 

I realize that this post is only useful when all steps are posted .. Just hang on, they’ll be here soon :-), they are already mostly written. Until then, you at least know what to expect 😉

5.00 avg. rating (97% score) - 1 vote

Permanent link to this article: https://www.waldo.be/2015/05/22/create-iso-of-cumulative-update-with-powershell-overview/

8 pings

Skip to comment form

  1. […] « Create ISO of Cumulative Update with PowerShell – Overview […]

  2. […] post is about the first “step” we need, regarding transforming a download of a cumulative update to an useful ISO file. This step handles on Unzipping the download, and putting it in some kind of destination […]

  3. […] step is once again part of a bigger whole: turning your download of a Cumulative Update (CU) into an ISO image. In order to do that, I want to automate as much as possible: also the name and characteristics of […]

  4. […] step is once again part of a bigger whole: turning your download of a Cumulative Update (CU) into an ISO image. In order to do that, I want to automate as much as possible: also the name and characteristics of […]

  5. […] is the last step in turning your download of a Cumulative Update (CU) into an ISO file. In this part, we want to be able to copy a certain folder on your drive to a new ISO […]

  6. […] is the last step in turning your download of a Cumulative Update (CU) into an ISO file. In this part, we want to be able to copy a certain folder on your drive to a new ISO […]

  7. […] Bron : Waldo’s Blog Lees meer… […]

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.