Functions/Test-IsPreviousDeploySettingsFileMissing.ps1
|
<#
.SYNOPSIS Tests whether the previous deployment settings file exists. .DESCRIPTION The Test-IsPreviousDeploySettingsFileMissing function checks if the specified deployment settings file exists. This is used to determine if this is the first deployment or if the settings file has been deleted since the last deployment. .PARAMETER DBDeploySettingsFile Specifies the path to the deployment settings file to check. If this parameter is null or empty, the function returns $false. .OUTPUTS Boolean Returns $true if the settings file is missing or the path is empty, $false if the file exists. .EXAMPLE Test-IsPreviousDeploySettingsFileMissing -DBDeploySettingsFile "C:\Deploy\settings.json" Returns $true if the file doesn't exist, $false if it does exist. .EXAMPLE Test-IsPreviousDeploySettingsFileMissing -DBDeploySettingsFile "" Returns $false because the path is empty. .NOTES If the DBDeploySettingsFile parameter is null or empty, the function returns $false. This function only checks for file existence, not file validity or content. #> Function Test-IsPreviousDeploySettingsFileMissing { [CmdletBinding()] param ( [Parameter(HelpMessage = "Path to the deployment settings file")] [string]$DBDeploySettingsFile ) Write-Verbose "Test-IsPreviousDeploySettingsFileMissing ($DBDeploySettingsFile)" if ([String]::IsNullOrEmpty($DBDeploySettingsFile)){ return $false } return !(Test-Path $DBDeploySettingsFile) } |