Remove “Unknown” computer from System Center Configuration 2012 R2 Manager PowerShell

Recently while testing out some task sequences with non-domain systems, I ended up with a bunch of “Unknown” computers in the Devices list in SCCM.  While I could filter this and remove it easily from the console, I wanted to set a task sequence to continually run through process while testing.

First, open PowerShell from Configuration Manager (to easily load the SCCM PowerShell Modules)
removeunknowndevice1

#Define your 3 character site code with this variable, in my example “ABC.”  I have defined the Site Code as I didn’t want the inherent x64 & x86 Unknown Computer Devices to be filtered from my results.  You could replace Unknown with another computer name, import a list via CSV, etc.

$sitecode = “ABC”
$devicename = “Unknown”
Get-CMDevice | Where-Object { ($_.SiteCode -ne $sitecode) -and ($_.Name -eq $devicename) } | Remove-CMDevice -force -confirm:$false

removeunknowndevice2

Note:  Please do this at your own risk – I’d suggest lab testing this first. 😉

About AJ McKean

Based in sunny Tauranga, New Zealand, AJ McKean is a Senior Systems Engineer in Mt Maunganui. With over 15 years of professional IT experience working in both New Zealand and the United States, he holds several certifications including MCSE(2000-2003), MCITP:Enterprise(2008), MCSA(2012), VMware VCP-DCV5.5, CompTIA A+ & is an HP Storage Architect. He is passionate about all things IT, especially virtualization, automation & cloud technologies.

One response to “Remove “Unknown” computer from System Center Configuration 2012 R2 Manager PowerShell”

  1. Lance Karena says :

    Hi AK McKean. Do you Contract out as Support of SCCM operators?

    I am the IT admin for Havelock North High School. I run a SCCM 2012 for deploying OSs to laptops and PCs. Have been doing so for several years.

    Just before COVID19 lockdown I had 3 new (unknown) laptops to image and they all failed. I am back in to work again and am just going through the troubleshooting process. I run PXE boot and run F8. Cmtrace log shows me that it fails at PxeGetPxeData failed with (0x800040005) which led me to your website. -I can reimage a PC using the same TS no issue. and NIC drivers aren’t the problem –

    I looked into my Device list and see duplicate copies of unknown computers listed here. I ran your Powershell script but it Failed as it required certifications although i used Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass, Set-ExecutionPolicy -Unrestricted.

    More importantly, from time to time I have issues with SCCM that take me hours upon hours to figure out. I work alone with 1000 students 100 staff 80 Lptps, 200 PCs 90 Chromebooks BYOD and Full adobe products printers, etc etc. There are times I could really do with a SCCM expert to talk with or have Team viewer in to do a job….

    Would Really appreciate hearing back from you
    Cheers

Leave a Reply

Your email address will not be published. Required fields are marked *