How to mount the ISO file using PowerShell?

PowerShellMicrosoft TechnologiesSoftware & Coding

To mount the ISO file in Windows using PowerShell, we can use the Mount−DiskImage command. The below command will mount the image file stored at the C:\ISO location.

Mount−DiskImage −ImagePath "C:\ISOs\Windows_Server_2016_Datacenter_EVAL_en−us_14393_refresh (1).ISO"

Output

Attached : True
BlockSize : 0
DevicePath : \\.\CDROM0
FileSize : 6972221440
ImagePath : C:\ISOs\Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh (1).ISO
LogicalSectorSize : 2048
Number : 0
Size : 6972221440
StorageType : 1
PSComputerName :

You can also check from Windows Explorer that the disk is mounted.

To mount on the remote computer, we can use CIMSession as a remote session and mount the disk.

$sess = New−CimSession −ComputerName Labmachine2k12
Mount−DiskImage −CimSession $sess −ImagePath
F:\Windows_Server_2016_Datacenter.iso

In the above example, Disk Image file ISO will be mounted on the remote computer LabMachine2k12 which is available on the same server (LabMachine2k12) on the F: path.

raja
Published on 25-Jan-2021 07:22:54
Advertisements