Private/Helper/Get-VolSizeTotal.ps1
<#
Copyright © 2024 Integris. For internal company use only. All rights reserved. #> FUNCTION Get-VolSizeTotal { <# .SYNOPSIS Retrieves the total size of a specified volume in gigabytes. .DESCRIPTION This function calculates and returns the total size of the specified drive letter in gigabytes. .PARAMETER DriveLetter The drive letter of the volume to check. Default is "C". .EXAMPLE Get-VolSizeTotal -DriveLetter "D" .NOTES The function uses the Get-CimInstance cmdlet to query the CIM_LogicalDisk class for total size. #> PARAM ( $DriveLetter = "C" ) $DriveLetter = $DriveLetter.Replace(":","") $DriveLetter = $DriveLetter.Replace("\","") RETURN [Math]::Round((Get-CimInstance -ClassName CIM_LogicalDisk | Where-Object DeviceID -like "*$DriveLetter*").Size / 1GB,0) } |