DISKPART vs PowerShell Get-Volume

PollusB

In DISKPART.EXE, I get the info when multiple mount points are assigned to a volume. In the picture we see that Drive G: can also be accessed using D:\SQL\MSSQL13.MSSQLSERVER\DATA\ or D:\BlaBla:

DISKPART result

But I can't find the same info using PowerShell's Get-Volume or Get-WMIObject -Class Win32_Volume. Does anyone knows how to extract this info using a native PowerShell function?

Get-Volumeの結果

I thought of extracting the info by calling DISKPART.EXE inside PowerShell but I would prefer an native PowerShell function like Get-Volume.

Ansgar Wiechers

Perhaps surprisingly, you can look up mount points via the Win32_MountPoint class:

Get-WmiObject Win32_MountPoint | Select-Object Directory, Volume

Further details can be obtained by looking up the references:

Get-WmiObject Win32_MountPoint | ForEach-Object {
    $dir = [wmi]$_.Directory | Select-Object -Expand Name
    $vol = [wmi]$_.Volume
    New-Object -Type PSObject -Property @{
        Directory   = $dir
        Label       = $vol.Label
        DriveLetter = $vol.DriveLetter
        FileSystem  = $vol.FileSystem
        DeviceId    = $vol.DeviceId
    }
}

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

DISKPARTとPowerShellのGet-Volume

分類Dev

Powershell 3.0:「Get-Volume」の代替

分類Dev

PowerShellでdiskpartを使用する

分類Dev

Docker volume vs Kubernetes persistent volume

分類Dev

PowerShellはGet-Volumeをスキップします

分類Dev

powershell を使用して diskpart コマンドを実行する

分類Dev

PowerShell - Var inside Format-Volume

分類Dev

Kubernetes - Get EBS Volume of a Pod

分類Dev

Powershellモジュール:Get-Module -All vs Get-InstalledModule

分類Dev

Docker Compose Relative paths vs Docker volume

分類Dev

Azure CLI vs Powershell?

分類Dev

Azure CLI vs Powershell?

分類Dev

PowerShell -match vs -like

分類Dev

C# vs PowerShell

分類Dev

How to get volume level from the command line?

分類Dev

Powershell Command vs Variable Formatting

分類Dev

Get file version in PowerShell

分類Dev

Get file version in PowerShell

分類Dev

Powershell'Get-StoredCredential '

分類Dev

Powershell foreach + Get

分類Dev

Partition shrink with diskpart does nothing

分類Dev

get vs getProperty in groovy

分類Dev

USB headphones get muted when setting volume below a certain threshold

分類Dev

Is there a way to get the current volume output from command-line on Windows?

分類Dev

(PowerShell)Select-String vs Findstr

分類Dev

getText()vs text()vs get_text()

分類Dev

diskpartはコマンドラインパラメータを使用できますか?または、PowerShellでそれらを偽造できますか?

分類Dev

SSRS and PowerShell: Get report as Excel

分類Dev

PowerShell get deleted files of a folder