Function List-Partitions(){
 #***************************************
    # Purpose: create an arralist of Partition
    #***************************************
    $ArrayDrive = New-Object System.Collections.ArrayList

    $partitionInfo = @(
       $partitions = (Get-CimInstance -Classname Win32_LogicalDisk | Where-Object -FilterScript {($_.DriveType -eq 3)} ) #Hard Drive
       if ($null -ne $partitions){
        ForEach ($partition in $partitions) {
               $PartitionUsedSpace = ($partition.Size - $partition.Freespace )
               $AssociatorLetterToIndex = Get-CimInstance -Query "ASSOCIATORS OF {Win32_LogicalDisk.DeviceID='$($partition.DeviceID)'} WHERE AssocClass=Win32_LogicalDiskToPartition"
                    foreach($Item In $AssociatorLetterToIndex){
                    $AssociatorIndex = Get-CimInstance -Query "ASSOCIATORS OF {Win32_DiskPartition.DeviceID='$($Item.DeviceID)'} WHERE AssocClass=Win32_DiskDriveToDiskPartition"
                    [pscustomobject]@{
                       Number=$Item.Index; DiskIndex = $Item.DiskIndex ; DiskType = $Item.DiskIndex ; DiskSize = [math]::Round($AssociatorIndex.Size / 1GB);
                       DriveLetter=$partition.DeviceID ; Available= [math]::Round($partition.Freespace / 1GB)  ;  Size = [math]::Round($partition.Size / 1GB) ;
                       CaptureSize= [math]::Round($PartitionUsedSpace / 1GB); FileSystem = $partition.FileSystem
                    }
                }
            }
         }
        else{
            Add_Log -Message ("No Disk and Partition Found!") -Severity 3 -Component "ListPartitions"
        }
    )

    $ArrayDrive.AddRange($partitionInfo)
    return $ArrayDrive

}

List-Partitions | Format-Table -AutoSize