#io #filesystem #linux #windows #bash #powershell
Linux
Bash
# requires lvm2
lvsWindows
Command Prompt
wmic logicaldisk get deviceid, volumename, descriptionPowerShell
Get-PSDrive -PSProvider FileSystemA more advanced function to get logical drives filtered by the type of drive (e.g. fixed, network, RAM).
function Get-LogicalDrives {
[CmdletBinding()]
param(
[ValidateSet('CDRom', 'Fixed', 'Network', 'NoRootDirectory', 'Ram', 'Removable', 'Unknown')]
[string[]]
$DriveType
)
process {
[System.IO.Directory]::GetLogicalDrives() | Where-Object {
$null -eq $DriveType -or
([System.IO.DriveInfo]$_).DriveType -in $DriveType
}
}
}Arguments
DriveType one or more of CDRom, Fixed, Network, NoRootDirectory, Ram, Removable, Unknown
Outputs
an array of System.IO.Directory representing the logical volumes matching the filter