#SCCM Expert #Private Cloud Consultant#SQL Expert#Corporate Trainer #Automation Consultant

System Center Orchestrator runbook for removing SCCM records

Hi Everyone ,

Hope you are doing great! Today i am writing about an scenario  which talks about automating SCCM record removal through Orchestrator .

The runbook once  created will look like the following :

sccmclientremoval

You can use the following Powershell script to remove the record from the database :

$error.clear()

powershell{
cd “D:\Program Files\Microsoft Configuration Manager\AdminConsole\bin”;
import-module .\configurationmanager.psd1;
set-location \`d.T.~Ed/{7FD7AB41-87F7-4E8C-9218-BEE9ACC188E9}.{DEB5CFDE-44C0-474E-87D6-0AD6A68EF1A9}\`d.T.~Ed/:
remove-cmdevice -devicename “\`d.T.~Ed/{7FD7AB41-87F7-4E8C-9218-BEE9ACC188E9}.{4219AE46-A6F0-4C74-8F07-B159A362E39B}\`d.T.~Ed/” -force -ErrorAction SilentlyContinue
}

if ($error.count -gt 0) {
$result=$error[0].exception
} else {
$result=”success”
}

You can change the path of the configuration manager console accordingly .

Please let me know if you face any issues implementing the same .

 

Advertisements

Tagged as: , , , ,

Categorised in: Orchestrator, Powershell, SCCM, Server 2016, SQL, System Center 2016

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

Translate

%d bloggers like this: