设置驱动器号影响其他磁盘

时间:2016-08-26 08:31:53

标签: powershell uefi vhd

我已将VHD附加到diskpart,磁盘编号为2$drive_ltrs = (get-partition -disknumber 2).driveletter返回D。如果现在我将W分配给EFI分区,D将被删除。为什么会这样?

${vol_letter_efi} = get-partition | where-object {$_.GptType -eq "{C12A7328-F81F-11D2-BA4B-00A0C93EC93B}"} | select-object -first 1 DriveLetter
${vol_letter_efi} = ${vol_letter_efi}.DriveLetter
if([string]${vol_letter_efi} -eq ""){
    ${vol_letter_efi} = get_efi_partition_letter %just returns W
    $part_nr_efi = get-partition | where-object {$_.GptType -eq "{C12A7328-F81F-11D2-BA4B-00A0C93EC93B}"} | select-object -first 1 PartitionNumber
    $part_nr_efi = $part_nr_efi.PartitionNumber
    Get-Partition -PartitionNumber $part_nr_efi | Set-Partition -NewDriveLetter ${vol_letter_efi}
}

0 个答案:

没有答案