我希望使用Powershell获取VHD挂载的驱动器号。我可以使用以下cmdlet挂载VHD:
Mount-VHD -Path d:/tmp.vhdx
挂载工作正常,但是当我尝试获取驱动器号时:
Get-DiskImage -ImagePath d:\tmp.vhdx | Get-Disk | Get-Partition | Get-Volume ).DriveLetter
失败并出现以下错误:
Get-DiskImage:无效的属性
我相信Get-DiskImage
适用于ISO,但不适用于VHD?你能帮助我获得VHD吗?
答案 0 :(得分:0)
error: Your local changes to the following files would be overwritten by merge:
<list of files>
Please, commit your changes or stash them before you can merge.
答案 1 :(得分:0)
这种方式对我有用:
let webURL = web.url
然后$DriveLetter = (Mount-VHD -Path "G:\YourVHDX.vhdx" -PassThru | Get-Disk | Get-Partition | Get-Volume).DriveLetter
将显示驱动器号。