Skip to content

Sys_GetFreeDiskSpace

Gets the free disk space on a drive, and checks it against the space the package requires.

Sys_GetFreeDiskSpace(sDrive, iRequired) As Boolean

Drive to check, for example C:\. You can also use a path on the drive.

Required free space in megabytes (MB)

If there’s enough free space, the free space in MB is stored in giValue, and gbSuficientDiskSpace is set to True.

If the free space is less than iRequired, the function writes this to the package log, sets the package status to Not Compliant (see CMS_SetPackageStatusToNotCompliant), and returns False. giValue isn’t updated in this case.

The function also returns False if the drive doesn’t exist.

If bStatus Then bStatus = Sys_GetFreeDiskSpace ("C:\", 10)
If bStatus Then bStatus = Job_Writelog("Custom", "giValue: " & giValue, bStatus, True)

Scripting Guidelines

Sys_GetFileSystemType Sys_GetDriveType Constants Package Property Variables