How to uninstall or remove SCCM client

Hey! I work with a company, that the customers, come and go pretty much. So sometimes they gonna install the CM-agent and sometimes some customers leaves. Then we need to uninstall the CM-Agent remotely of course! God forbidden manually!

You need
* Server 2008 R2 or above
* Windows 7 With powershell 3.0 installed or above
* CM2012

1. Create a Collection.

2. Create a Configuration item

2.1 Then the “Setting step”, Modify like below

2.2 Choose Script like this:
2017-12-19 16_38_23-sql.invidjkp.local - ASG-RemoteDesktop 2017 - SCCM02.png
2.3 Edit “Discovery Script”: Then you post in this:


function Get-ccmexec-service
{
    [CmdletBinding()]
    param ()

    Begin
    {
    }
    Process
    {
    Try {
    Get-Service -Name CcmExec |
        ForEach-Object {
            If($_.Name -eq "none") {
                $State = 0 }
            ElseIf($_.Name -eq "ccmexec") {
                $State = 1}
            }

     }
   catch {
   # Error handling

   }
   $state

    }
    End
    {
    }
}
Get-ccmexec-service

2017-12-19 16_42_42-sql.invidjkp.local - ASG-RemoteDesktop 2017 - SCCM02.png
2.4 Then “Remidiation Script” you post in this:
C:\Windows\ccmsetup\ccmsetup.exe /uninstall
2017-12-19 16_43_04-sql.invidjkp.local - ASG-RemoteDesktop 2017 - SCCM02.png
2.5 Then in the Compliance Rules tab, Add this:
2017-12-19 16_44_14-sql.invidjkp.local - ASG-RemoteDesktop 2017 - SCCM02.png
2.4. The Finish the Configuration Item Wizard.

3. Create a Baseline to this, And put the deployment to your Colleciton.

4. And you are Done

Good Luck

/Pontus

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s