如何使用PowerShell掛載ISO檔案?
要使用PowerShell在Windows中掛載ISO檔案,我們可以使用Mount−DiskImage命令。下面的命令將掛載儲存在C:\ISO位置處的映像檔案。
Mount−DiskImage −ImagePath "C:\ISOs\Windows_Server_2016_Datacenter_EVAL_en−us_14393_refresh (1).ISO"
輸出
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 :
您還可以從Windows資源管理器中檢查磁碟是否已掛載。
要掛載在遠端計算機上,我們可以使用CIMSession作為遠端會話並掛載磁碟。
$sess = New−CimSession −ComputerName Labmachine2k12 Mount−DiskImage −CimSession $sess −ImagePath F:\Windows_Server_2016_Datacenter.iso
在上面的示例中,映像檔案ISO將掛載到此伺服器(LabMachine2k12)上的F:路徑中可用的遠端計算機LabMachine2k12上。
Advertisement