Learn about Windows PowerShell
Summary: Use Windows PowerShell to mount an ISO or VHD file.
I can double-click an ISO file to access it in Windows 8.1, but is there a Windows PowerShell cmdlet that will do that for me?
Use the Mount-DiskImage cmdlet and specify the file name:
For an ISO file:
Or for a VHD file:
Is this supported in Windows 2008 ?
@Dave Wolf: It would seem so. http://technet.microsoft.com/en-us/library/hh848706(v=wps.620).aspx
@dave No, these Cmdlets do not exist within Server 2008 for either ISO or VHD. You can mount an ISO natively in Server 2012, you can mount a VHD natively in Server 2008 R2. I believe the Cmdlets started to appear in Server 2008 R2. However there ARE options
for mounting an ISO. Virtual Clone Drive from slysoft.com has worked well for me on Server 2008 in the Past and DOES support Command line options. Within Server 2008 you might be able to use DISKPART to mount a VHD but I don't have Server 2008 handy to play
and how would your powershell script know which drive letter was selected for the mounted ISO/VHD?
I need to programmatically mount many VHDs (one at a time) and copy out a single folder out of each one
The following from the scripts in Thomas Lees' series at
http://tfl09.blogspot.com/search/label/Virtual%20Labs works for me.
# Mount the OS ISO image onto the local machine
Write-Verbose "Mounting ISO image [$Iso]"
Mount-DiskImage -ImagePath $Iso
# Get the Volume the Image is mounted to
Write-Verbose 'Getting disk image of the ISO'
$iSOImage = Get-DiskImage -ImagePath $Iso | Get-Volume
Write-Verbose "Got disk image [$($iSOImage.DriveLetter)]"
# And get the drive Letter of the dirve where the image is mounted
# add the drive letter separator (:)
$iSODrive = "$([string]$iSOImage.DriveLetter):"
Write-Verbose "OS ISO mounted on drive letter [$iSODrive]"