Jump to content


  • 0
johnli

Powershell – Delete Computer from SCCM

Question

Hi,

 

I'm looking for a simple Poweshell script to delete computers from SCCM.
I found various examples, but nothing seems to works well.
Also this script from from Microsoft is not doing the trick for me : https://gallery.technet.microsoft.com/scriptcenter/Remove-old-Active-7fc40c61
Suggestions, examples is welcome !
Thanks!

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0
[cmdletbinding()]
Param(
    [Parameter(Mandatory)]
    [String]
    [ValidateNotNullOrEmpty()]
    $ComputerName
)

cls

$SiteCode = "XXX"

Import-Module -Name "$(split-path $Env:SMS_ADMIN_UI_PATH)\ConfigurationManager.psd1"
cd $SiteCode":"

Remove-CMDevice -DeviceName $ComputerName -Confirm:$false -Verbose -Force

This should do the trick. The SCCM Console has to be installed on the computer. Also make sure you replace the site code in the script with your own.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.