Support for mount and install from .iso image

Jan 4, 2014 at 7:20 PM
I have .iso images of software that I'd like to install (Visual Studio, MS Office) that take too long to download via Chocolatey. Is there a way to use BoxStarter to mount the .iso image and kick off the installation?
Jan 5, 2014 at 1:39 AM
Technically yes, but ISO installation does not have "first class" support. So if you are comfortable doing some powershell scripting, it is not too bad. Here is what I would do:
  1. Create a separate chocolatey package for each ISO. Here is an example of what a package install script would look like for VS 2013 Ultimate:
$path=<the path to your ISO file. I'm assuming you keep this on a share somewhere.>
Mount-DiskImage -ImagePath $path
$driveLetter = (Get-DiskImage $path | Get-Volume).DriveLetter
Install-ChocolateyInstallPackage "VisualStudio2013Ultimate" "EXE" "/Passive /NoRestart /AdminFile '$driveLetter:\AdminDeployment.xml' /Log $env:temp\vs.log" "$driveLetter:\vs_ultimate_download.exe"
The above assumes that you are are installing on a Windows 8/8.1 or server 2012/2012 R2 OS. Those versions have powershell versions supporting the Mount-DiskImage cmdlet. If you are installing to win 7, you could install powershell 3 (cinst powershell) to get that cmdlet.

The Office install will be more involved. You could take a look at the Chocolatey Office package at and use it as a template for how to build a similar package that gets its files from an ISO.
Jan 6, 2014 at 9:28 PM

Is the Mount-DiskImage cmdlet available in Windows Server 2008? You mention it is available for Windows 7.


Jan 6, 2014 at 9:43 PM
No its only available to win 8/win 2012 and above. I had thought that IF you install powershell 3 on win 7 then it would be available but I think I was wrong about that. There is a command line tool out there that provides similar functionality for powershell 2 environments. I forget it right now but it is on choco.
Jan 7, 2014 at 9:23 PM
I think it might be imdisk that you are thinking of. Is that right?

With regard to the above script, I have tried something similar for installing Visual Studio 2010 from a mounted iso, I am using the following:
$path = "D:\en_visual_studio_2010_premium_x86_dvd_509357.iso"
$mountPath = Mount-Iso $path  
$exePath = ($mountPath + "setup\setup.exe")
Install-ChocolateyInstallPackage "VS2010PremiumMsdn" "EXE" "/unattendfile $configFile" $exePath
Where the Mount-Iso function wraps up the work of mounting and getting the drive letter.

However, when the call executes, the result is the following:
Write-Error : VS2010PremiumMsdn did not finish successfully. Boo to the chocolatey gods!
[ERROR] Access to the path 'F:\setup\setup.exe.ignore' is denied.
At C:\Chocolatey\chocolateyinstall\helpers\functions\Write-ChocolateyFailure.ps1:30 char:2
+     Write-Error $errorMessage
+     ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Write-Error

Write-Error : Package 'VS2010PremiumMsdn v1.0.0' did not install successfully: Access to the path 'F:\setup\setup.exe.ignore' is denied.
At C:\Chocolatey\chocolateyinstall\functions\Chocolatey-NuGet.ps1:90 char:17
+                 Write-Error "Package `'$installedPackageName v$installedPackageV ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Write-Error
Did this also happen for you? If so, do you know a way around this?


Jan 7, 2014 at 9:51 PM
Also. for doing the ISO mounting and dismounting, this script seems to do a very good job:

May be interesting to get this added into either Boxstarter, or Chocolatey, for first class ISO support.

Jan 7, 2014 at 10:09 PM
To be honest, I didn't actually try this with chocolatey. I've worked with mounting ISOs and VHDs but never in a choco package. Have you tried doing this outside of chocolatey? That might be a good place to start troubleshooting.

Yeah. I saw that gist too and it looks like it would work. I definitely think working with ISOs as install targets would fall on the chocolatey side of things.
Jan 7, 2014 at 10:18 PM
mwrock wrote:
Yeah. I saw that gist too and it looks like it would work. I definitely think working with ISOs as install targets would fall on the chocolatey side of things.
Yip, me too.
Jan 7, 2014 at 10:33 PM
Edited Jan 7, 2014 at 11:03 PM
Based on our Twitter conversation, sounds like you are hitting a PS3 bug that I previously struggled with too. After mounting a disk, the current powershell session cant see the drive. This is fixed in PS4 but the workaround is to explicitly add a new PSDrive:
        $before = (Get-Volume).DriveLetter
        mount-vhd $VHDPath
        $after = (Get-Volume).DriveLetter
        $winVolume = compare $before $after -Passthru
        $winVolume | % { new-PSDrive -Name $_ -PSProvider FileSystem -Root "$($_):\" -SilentlyContinue | out-null}
In my case Iwas working with VHDs but I'm sure the issue is the same with ISOs.
Jan 7, 2014 at 10:36 PM
From the output of $psversiontable, I have PowerShell 4, so is this going to be the same issue?

WRT the above script, is there something missing from the last line. There is a stray - at the end.


Jan 7, 2014 at 11:06 PM

Oops. Just edited myresponse. Sounds like tyou have R2 with PS4. I was told it was fixed in PS4 but its possible something was miscommunicated and it’s a different bug or you are running into an entirely different issue. Give it a try and see if it helps.

Jan 8, 2014 at 7:19 AM
Hello Matt,

Thanks for the above, it seems to work. The only slight change that I had to make was to move the -SilentlyContinue flag, as I got an error message stating that this flag was not recognised. Do you think this is as a result of the different PowerShell versions?

With the above working though, I was then met with the case that the iso was mounting, and then after about 1 minute, it would unmount again. There were no errors piped to the powershell window, and Visual Studio was not installed.

DIgging into this a bit deeper, I found a log file in $env:temp, that informed me of the following:
[01/08/14,07:04:42] vs70uimgr: F:\
[01/08/14,07:04:42] vs70uimgr: Drive type = DRIVE_CDROM
[01/08/14,07:04:42] Setup.exe: AddGlobalCustomProperty
[01/08/14,07:04:42] vs70uimgr: ***ERRORLOG EVENT*** : Admin deployment is not allowed from a CD/DVD.
[01/08/14,07:04:42] Setup.exe: AddGlobalCustomProperty
[01/08/14,07:04:42] setup.exe: ***ERRORLOG EVENT*** : InitializeUIManager(), Start failure
[01/08/14,07:04:42] Setup.exe: AddGlobalCustomProperty
[01/08/14,07:04:42] setup.exe: ***ERRORLOG EVENT*** : CSetupManager::RunIntro() - Failed to Initialize UI Manager
[01/08/14,07:04:42] vs70uimgr: Entering DisplayMessage() method.
[01/08/14,07:04:42] vs70uimgr: DisplayMessage called in unattended mode: A problem has been encountered while loading the setup components. Canceling setup.
[01/08/14,07:04:42] Setup.exe: AddGlobalCustomProperty
[01/08/14,07:04:42] setup.exe: ***ERRORLOG EVENT*** : CSetupManager::RunLoadSetup() - Failed to Run the Intro
[01/08/14,07:04:42] Setup.exe: UnloadSuiteComponents()
This seems to put a complete end to what I am trying to achieve :-(

Do you have any bright ideas how to work around this? Aside from obviously extracting the setup files from the ISO and running from there? I was trying to avoid that if possible.