Functions/Resize-MyVolume.ps1
function Resize-MyVolume { [CmdletBinding()] param ( [Parameter(Mandatory)] [string] $DriveLetter ) Get-Disk | Update-Disk $MaxPartitionSize = Get-Partition -DriveLetter $DriveLetter | Get-PartitionSupportedSize | Select-Object -ExpandProperty SizeMax # Write-Host $MaxPartitionSize if ((Get-Partition -DriveLetter $DriveLetter).size -eq $MaxPartitionSize) { Write-Warning "Partition $DriveLetter is already the maximum size" } else { Resize-Partition -DriveLetter $DriveLetter -Size $MaxPartitionSize } } |