Write-Host "Missing Software listed below..." -ForegroundColor Red
if ($Zbook){
Compare-Object -ReferenceObject $SLZ -DifferenceObject $SLAcutal -Property DisplayName -PassThru |
Where-Object{$_.SideIndicator -eq '<='} |
Select-Object DisplayName | Format-Table -HideTableHeaders
}
Else{
Compare-Object -ReferenceObject $SLS -DifferenceObject $SLAcutal -Property DisplayName -PassThru |
Where-Object{$_.SideIndicator -eq '<='} |
Select-Object DisplayName | Format-Table -HideTableHeaders
}
This is my first script, Idealy, I would only like the write-host "missing software..." to be presented if compare ref. object doesn't match difference object. and "missing software" if matches
Any tips would be appreciated.
Thanks in advance