-CheckDiskSpace -RequiredDiskSpace custom error code


Currently I have an application deployment with the following requirement:

Show-InstallationWelcome -CloseApps 'iexplore' -CloseAppsCountdown 60 -CheckDiskSpace -RequiredDiskSpace 7168

It works great, and does exactly what it supposed to…except that when there isn’t enough disk space, it returns error code 1618 into ConfigMgr. I would like to assign a custom error code to this as I will need to adjust free space before I can retry. What is the best way to accomplish this to avoid scheduled retries until the disk space issue is resolved?

Thanks in advance!

Exit-Script -ExitCode 69000

Thanks for the reply, but I must still be missing something. Is there a value stored in a variable to check for with an IF statement? Or do I just add your text to the end of the Show-InstallationWelcome line?

You don’t have to use my line to exit the script. It’s built-in:

			If ($freeDiskSpace -lt $RequiredDiskSpace) {
				Write-Log -Message "Failed to meet minimum disk space requirement. Space Required [$RequiredDiskSpace MB], Space Available [$freeDiskSpace MB]." -Severity 3 -Source ${CmdletName}
				If (-not $Silent) {
					Show-InstallationPrompt -Message ($configDiskSpaceMessage -f $installTitle, $RequiredDiskSpace, ($freeDiskSpace)) -ButtonRightText 'OK' -Icon 'Error'
				Exit-Script -ExitCode $configInstallationUIExitCode

Thank You - this was very helpful!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.