Execution Flow
Synopsis
Combines Get-Partition, Get-Disk, and Get-CimInstance Win32_LogicalDisk to provide a complete picture of a single drive. The free-space threshold is read from Get-sqmConfig -Key 'DiskFreeSpaceThresholdPct'. When free space falls below the threshold, ExtendNeededGB is calculated to determine the minimum disk extension required. Shared-disk detection queries all partitions on the same physical disk for other drive letters.
ExtendNeededGB = Ceil( (threshold × TotalGB − FreeGB) ÷ (1 − threshold) )
# threshold = DiskFreeSpaceThresholdPct / 100
# threshold = DiskFreeSpaceThresholdPct / 100
Syntax
Get-sqmDiskInfoByDriveLetter -DriveLetter <String> # single letter A-Z [-NoClipboard] [-EnableException]
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| -DriveLetter | String | Required | Single drive letter (A–Z) to inspect. Do not include colon or backslash. |
| -NoClipboard | Switch | false | Suppress copying the result to the clipboard. |
| -EnableException | Switch | false | Throw terminating exceptions. |
Return Value
| Property | Description |
|---|---|
| DriveLetter | Drive letter inspected. |
| DiskNumber | Physical disk number from Get-Partition. |
| TotalGB | Total volume capacity in GB (rounded to 2 decimal places). |
| FreeGB | Free space in GB (rounded to 2 decimal places). |
| FreePercent | Free space as percentage of TotalGB. |
| ThresholdPct | Configured threshold from DiskFreeSpaceThresholdPct. |
| ExtendNeededGB | Minimum extension size in GB to reach threshold. 0 when free space is sufficient. |
| SerialNumber | Physical disk serial number from Get-Disk. |
| IsVM | Boolean — true if running in a virtual machine (via Get-sqmMachineType). |
| MachineType | Physical / HyperV / VMware / etc. |
| IsPartitionedDisk | Boolean — true if this physical disk contains other drive letters. |
| SharedWith | List of other drive letters on the same physical disk. |
Examples
# Get info for drive D: Get-sqmDiskInfoByDriveLetter -DriveLetter "D" # Suppress clipboard copy (e.g. in automated scripts) Get-sqmDiskInfoByDriveLetter -DriveLetter "E" -NoClipboard # Check if extension is needed $info = Get-sqmDiskInfoByDriveLetter -DriveLetter "D" if ($info.ExtendNeededGB -gt 0) { Write-Host "Extend D: by at least $($info.ExtendNeededGB) GB" }