script to match software Powershell
script to match software Powershell
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
$SLZ
$SLS
You likely want an
if(){}else{}
statement to accomplish that– trebleCode
2 days ago
if(){}else{}
I created variables for $SLZ, $SLS, & $SLActual.
– MattyS
yesterday
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
You're missing some information... What are you comparing? How are you defining
$SLZ
and$SLS
?– TheIncorrigible1
Jun 29 at 21:13