I think maybe for newer chef clients, there's no .msi file left behind to run that will allow you to uninstall the chef client in scripts/cleanup.ps1. I added the following bit below the existing uninstall attempt and it seems to have resolved the issue:
# Modern chef clients should be uninstalled through 'Add/Remove Programs'
$chef = Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -match "Chef" }
if ($chef) {
$chef.uninstall()
}
I think maybe for newer chef clients, there's no
.msi
file left behind to run that will allow you to uninstall the chef client inscripts/cleanup.ps1
. I added the following bit below the existing uninstall attempt and it seems to have resolved the issue: