I have searched everywhere for this, but am unable to find a quick solution for what I need to do. At my company, we have SCOM 2007 agents on all 2000 of our workstations. Through the course of machines being replaced, etc, sometimes the clean up of Active Directory and the SCCM/ SCOM consoles does not get done. I created a PowerShell script that does the following:
1. Generates a list of "Dead" PC's based on PasswordLastset value in Active Directory. Any PC whose PasswordLastSet value is 150 days or older gets added to the list.
2. These PC's are then deleted from Active Directory with a few lines of PowerShell code.
3. They are then deleted form SCCM console using another few lines of PowerShell code.
The problem I am having is finding a way with PowerShell to remove the PC names from the console. Currently I have to manually delete from the console. I was really hoping to automate this process.
The PowerShell script called DeleteAgent.ps1 that i have found does not seem to work.
So far, I have been able to connect to the SCOM server in PowerShell and generate a list of all agents.
Any help would be greatly appreciated.
Matt Dillon