Hiya,
What this code should do is look at the results of
"SELECT *
FROM win32_service
WHERE name LIKE '%SQL%'
OR name LIKE '%MSOLAP%'
OR name LIKE '%ReportServer%'
OR name LIKE '%MSDtsServer%'" `
and if there are no services with those names print SQL not installed
if($Srvc.count -eq 0)
{
Write-Host "SQL Not Installed on $Server "
}
and if there are then it will display as you had it previously using this bit
else
{
Write-Output ("Server: {0}" -f $server);
Write-Output $srvc | Format-Table $fmtName, $fmtMode, $fmtState, $fmtStatus, $fmtMsg;
}
Is that not the result are you looking for?
https://blog.robsewell.com Its where I blog
SQL Community Slack Channel https://sqlps.io/slack
The Best PowerShell Module for the Modern SQL DBA https://dbatools.io
Data South West User Group http://sqlsouthwest.co.uk/[/url]