6

When I mount an ISO file like C:\temp\demo.iso by double clicking it on Windows 10 and/or Windows Server (or Mount-DiskImage powershell command) I can see the new disk (in this case it returned a new drive I:):

Get-Volume I | fc

class CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_Volume
{
  ObjectId = {1}\\HOST01\root/Microsoft/Windows/Storage/Providers_v2\WSP_Volume.ObjectId="{de774a20-4e16-11e8-ad1
  e-806e6f6e6963}:VO:\\?\Volume{354097cd-6bd5-11e7-a5d9-aaaaa99b2b5d}\"
  PassThroughClass =
  PassThroughIds =
  PassThroughNamespace =
  PassThroughServer =
  UniqueId = \\?\Volume{354097cd-6bd5-11e7-a5d9-aaaaa99b2b5d}\
  AllocationUnitSize = 2048
  DedupMode = NotAvailable
  DriveLetter = I
  DriveType = CD-ROM
  FileSystem = CDFS
  FileSystemLabel = 20190306-134242
  FileSystemType = Unknown
  HealthStatus = Healthy
  OperationalStatus = OK
  Path = \\?\Volume{354097cd-6bd5-11e7-a5d9-aaaaa99b2b5d}\
  Size = 2136489984
  SizeRemaining = 0
  PSComputerName =
}

But I can't see what the image source file path (the c:\temp\demo.iso) for that disk was. mount-diskimage returns this information as a result object, but where can I get it after the fact or when mounted with explorer? I need to script that with powershell.

4
  • 1
    What value in the example above are you expecting to see? When you say image source file, what exactly do you want it to tell you? the iso filename you mounted?
    – Narzard
    Mar 27, 2020 at 21:03
  • Added an example in the question @Narzard
    – eckes
    Mar 27, 2020 at 21:03
  • 3
    I think you want: Get-Volume -DriveLetter I | Get-DiskImage
    – Narzard
    Mar 27, 2020 at 21:09
  • @Narzard get-diskimage in this case returns nothing, I guess it only works with imagepath, it can't extract that from the Volume object. But basically that would be a good cmdlet if it worked.
    – eckes
    Mar 27, 2020 at 21:17

1 Answer 1

5

If you know the DevicePath then

Get-DiskImage -DevicePath \\.\CDROM0

If you only know the Drive letter try (you need to remove the end '\' from path)

Get-Volume -DriveLetter I  | % { Get-DiskImage -DevicePath $($_.Path -replace "\\$")}

Sample result:

Attached          : True
DevicePath        : \\.\CDROM1
FileSize          : 2494107648
ImagePath         : C:\temp\demo.iso
LogicalSectorSize : 2048
...
2
  • Cool, get-diskimage -devicepath works, it returns in an ImagePath property the path I need.
    – eckes
    Mar 27, 2020 at 22:05
  • And then Dismount-DiskImage -DevicePath \\.\CDROM0 great.
    – js2010
    Sep 27, 2023 at 19:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .