I tried to use NoDriveLetter to mount a disk image to an empty folder. A straightforward task in DiskManager, but turned out to be more complicated in PowerShell.
Mount-DiskImage will return a CimInstance object, but of the MSFT_DiskImage type. The only way I know to assign a path to a mount is Add-PartitionAccessPath. How can I tell Add-PartitionAccessPath which disk to mount? Mount-DiskImage will not give me an Id, DiskNumber or DriveLetter (with NoDriveLetter at least). That leaves InputObject as the only choice. InputObject should be a CimInstance object, but of the MSFT_Partition type.
I have tried:
PS > $Image = Mount-DiskImage -ImagePath D:\Images\en_office_professional_plus_2010_with_sp1_x86_x64_dvd_730330.iso -NoDriveLetter -PassThru
PS > $Image | select-object -Property *
Attached : False
BlockSize : 0
DevicePath :
FileSize : 2647570432
ImagePath : D:\Images\en_office_professional_plus_2010_with_sp1_x86_x64_dvd_730330.iso
LogicalSectorSize : 2048
Number :
Size : 2647570432
StorageType : 1
PSComputerName :
CimClass : ROOT/Microsoft/Windows/Storage:MSFT_DiskImage
CimInstanceProperties : {Attached, BlockSize, DevicePath, FileSize...}
CimSystemProperties : Microsoft.Management.Infrastructure.CimSystemPropertiesI haven't found a way to feed that to Add-PartitionAccessPath. I even tried:
$Volume = Get-Volume -DiskImage $Image $Partition = Get-Partition -Volume $Volume $Source = Add-PartitionAccessPath -InputObject $Partition -AccessPath $MntDir -PassThru
but Get-Partition can't see the volume if it isn't mounted.
This brings me back to the question in the title. What is the intended use of NoDriveLetter?
Am I overlooking something obvious? (It wouldn't be the first time..)