最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

windows - Why doesn't the AccessPath shows up in the Partition object after an `add-PartitionAccessPath`? - Stack Overfl

programmeradmin4浏览0评论

PowerShell 5 on Windows Server 2022

I would like to mount a VHDX and continue with an updated Partition object, but the one returned by Add-PartitionAccessPath -PassThru isn't up-to-date as it doesn't contain the new mount-point:

$ImagePath = 'C:\file.vhdx'
$AccessPath = 'C:\dir\'

Mount-DiskImage -ImagePath $ImagePath -NoDriveLetter -Access ReadOnly -PassThru |
Get-Disk | Get-Partition | ? Type -Eq Basic |
Add-PartitionAccessPath -AccessPath $AccessPath -PassThru |
Format-List

output:

UniqueId             : {00000000-0000-0000-0000-000100000000}60022480208BAE8FEC721CF4EDB71157
AccessPaths          : {\\?\Volume{ff5a0fa9-eb5b-4d8d-9c22-0f0faecb321b}\}
DiskNumber           : 22
DiskPath             : \\?\scsi#disk&ven_msft&prod_virtual_disk#2&1f4adffe&0&000008#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
DriveLetter          :
Guid                 : {ff5a0fa9-eb5b-4d8d-9c22-0f0faecb321b}
IsActive             : False
IsBoot               : False
IsHidden             : False
IsOffline            : False
IsReadOnly           : False
IsShadowCopy         : False
IsDAX                : False
IsSystem             : False
NoDefaultDriveLetter : False
Offset               : 16777216
OperationalStatus    : Online
PartitionNumber      : 2
Size                 : 2 TB
Type                 : Basic

As you can see, the AccessPaths property of the Partition object doesn't contain $AccessPath.

Is it an expect behaviour? What should I do to continue the pipeline with an "up-to-date" Partition Object?

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论