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.
1 Answer
If you know the DevicePath then
Get-DiskImage -DevicePath \\.\CDROM0If 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
... 1