Print this Post

Create ISO of Cumulative Update with PowerShell – Create the ISO

052115_1446_CreateISOof1.pngThis 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 file.

I had no idea how to start with this .. and what do you do when you have no clue? You goo.. sorry .. You BING it (I admit, I googled … ;-))! And here are some resources that really put me in the right direction:

  • http://blogs.msdn.com/b/opticalstorage/archive/2010/08/13/writing-optical-discs-using-imapi-2-in-powershell.aspx. This one explained on how to move a folder to an imagestream. I used the first 3 steps of this one, which was actially the point where I should be able to write an ImageStream to disk. The latter appeared not that simple.. .
  • https://gist.github.com/marnix/3944688: After some searching, I found exactly what I was looking for: a PowerShell function “WriteIStreamToFile”. Appartenly, this is not really possible in PowerShell, because we can’t use “System.Runtime.InteropServices.ComTypes.Istream. There is more information in the link. You’ll see it’s quite funky: writing C# code in powershell, adding a type which we will be able to use then in PowerShell. I just use this function as-is!

So, the main function is called “New-ISOFileFromFolder” and this is how it looks:

You see that I use the resources from above: adding a folder to an image, and having an ImageStream as result. This imagestream is going to be converted to a file with the exact downloaded function from above “Write-IStreamToFile“, which looks like this:

And there you go, last step is finished! And we have all components we need to convert our exe, our exact download of partnersource of a Cumulative Update, and turn it into an ISO file.

0.00 avg. rating (0% score) - 0 votes

Permanent link to this article: http://www.waldo.be/2015/05/27/create-iso-of-cumulative-update-with-powershell-create-the-iso/


2 pings

  1. adam vonPtak

    How do I make the iso bootable?

    1. waldo

      I really don’t know – but there is tons of information on the internet… sorry ..

  1. Create ISO of Cumulative Update with PowerShell – Create the ISO | Pardaan.com

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

Leave a Reply

%d bloggers like this: