Mount ISO files

Mounting an ISO image is fairly easy:

Get-DiskImage -ImagePath D:\Downloads\winpe.iso | Mount-DiskImage

mount-diskimage

whereas listing all mounted images and dismounting them isn’t as easy as it seems to be.

Here’s the one-liner to achieve this :-):

Get-Volume | Where {($_.DriveType -eq "CD-ROM") -and ($_.Size -ne 0)}|            
Get-DiskImage | Where Attached | Dismount-DiskImage            
Advertisements

2 thoughts on “Mount ISO files

  1. The term ‘Get-DiskImage’ is not recognized as the name of a cmdlet, function, script file, or operable pr
    he spelling of the name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:14
    + Get-DiskImage <<<< -ImagePath C:\Users\Administrator\Desktop\CM-C-2648.iso | Mount-DiskImage
    + CategoryInfo : ObjectNotFound: (Get-DiskImage:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s