So we have a program called Chef that manages our configurations. While we have a list of these servers, I would like to automate which servers do and do not have chef installed, adjust a custom field called Chef_Managed, then have the Chef alerts applied to them. I have the automation set up to apply out alerts to anything with Chef_Managed = Yes. I just need to know how to use the powershell output from the below code change that field
$installed = Get-WmiObject -Class Win32_Product | sort-object Name | select Name | where { $_.Name -match “Chef Client”}
if($installed.name -like "*Chef*"){
$Managed = "True"
}else{
$Managed = "False"
}
Write-Output "Chef Managed status $Managed"