I have a IF condition which check for a file avaialble in the path and does the action of signing the scripts.
But I am looking for another condition here like, after the signing process has done successfully or not also it should check.
If (Test-Path -Path "$env:DigiCertificate"){
signtool sign /f $env:DigiCertificate /fd SHA256 /p $env:DigicertsPassword $MediaFolderPath\scripts\*.ps1 $MediaFolderPath\tools\*.exe
}
Else {
Write-Host "##[warning]For Digitally signing of scripts, required certificate not found to sign" -ForegroundColor Yellow
exit 1
}
So, here I have a condition to check for the Certificate and fail if its not there, but I am looking for the signtool operation fails to sign the scripts also it should fail. Please help me to achieve this.