我正在寻找的驱动器字母的VHD安装使用Powershell。我可以用下面的cmdlet安装VHD:
Mount-VHD -Path d:/tmp.vhdx安装工作正常,但当我尝试获得驱动器号时:
Get-DiskImage -ImagePath d:\tmp.vhdx | Get-Disk | Get-Partition | Get-Volume ).DriveLetter如果出现以下错误,它将失败:
获取-磁盘图像:无效属性
我相信Get-DiskImage对于国际标准化组织来说很好,但对VHD来说却不行?你能帮我为VHD弄到它吗?
发布于 2019-11-06 10:00:31
这种方式对我来说是可行的:
$DriveLetter = (Mount-VHD -Path "G:\YourVHDX.vhdx" -PassThru | Get-Disk | Get-Partition | Get-Volume).DriveLetter然后Write-Output $DriveLetter将显示驱动器的字母。
发布于 2019-01-24 19:44:41
$DriveLetter = (Mount-VHD -Path "G:\YourVHDX.vhdx" -PassThru | Get-Disk | Get-Partition | Get-Volume | Where-Object {$_.FileSystemLabel -like ""}).DriveLetterhttps://stackoverflow.com/questions/50226741
复制相似问题