PowerShell:使用DiscUtils创建并初始化虚拟磁盘
使用时,我得到以下错误:PowerShell:使用DiscUtils创建并初始化虚拟磁盘,powershell,virtual-machine,diskimage,Powershell,Virtual Machine,Diskimage,使用时,我得到以下错误: Import-Module DiscUtils.psd1 New-VirtualDisk hd.vhd -Type VHD-dynamic -Size 500MB Initialize-VirtualDisk hd.vhd -VolumeManager Bios Initialize-VirtualDisk : Path specified is not a virtual disk hd.vhd有效,如果使用其他工具装载,则Windows磁盘管理会识别 刚刚找到了
Import-Module DiscUtils.psd1
New-VirtualDisk hd.vhd -Type VHD-dynamic -Size 500MB
Initialize-VirtualDisk hd.vhd -VolumeManager Bios
Initialize-VirtualDisk : Path specified is not a virtual disk
hd.vhd
有效,如果使用其他工具装载,则Windows磁盘管理会识别 刚刚找到了正确的方法:
Import-Module DiscUtils.psd1
New-VirtualDisk hd.vhd -Type VHD-dynamic -Size 500MB
New-PSDrive vhd -PSProvider virtualdisk -Root hd.vhd -ReadWrite
Initialize-VirtualDisk vhd: -VolumeManager Bios
随后可以对驱动器进行分区和格式化。要格式化前250MB NTFS,请执行以下操作:
New-Volume vhd: -Size 250MB -Type WindowsNtfs
Format-Volume vhd:\Volume0 -Filesystem Ntfs -Label "virtdrive"