Remove computer from Configuration Manager (System Center 2012 R2) with script/batch/programatically?

IAmTheSquidward picture IAmTheSquidward · Jul 7, 2014 · Viewed 7.6k times · Source

We are having trouble with the Config Manager client randomly getting corrupted during installation on new computers. We are currently rebuilding our image, but in the meantime, we are implementing a short term solution where we simply completely uninstall Config Manager Client, remove the computer object from the Config Manager console, and then reinstall the client.

In an effort to reduce the "clicks" that our help desk techs would have to preform, I would like to write a simple script/batch/program/whatever to just do it in one fell swoop. My only holdup is that I don't know how to invoke Configuration Manager via the command line or Powershell and remove a computer from our Devices.

Is this even possible? I can't find any documentation from Microsoft.

Answer

IAmTheSquidward picture IAmTheSquidward · Jul 7, 2014

Found my answer. There is a wealth of Configuration Manager cmdlets available. I simply used "CM-GetDevice" to find a device, and then "Remove-CMDevice" to remove it completely.

http://technet.microsoft.com/en-us/library/jj821831(v=sc.20).aspx