/build/static/layout/Breadcrumb_cap_w.png

Check Machines in SCCM not in AD

Get all the computer in SCCM put them in a variable do a for each and ask AD if the computer is found and active. If not delete it form SCCM.

import-module ActiveDirectory

Import-Module $env:SMS_ADMIN_UI_PATH.Replace(“\bin\i386″,”\bin\configurationmanager.psd1”)
$computers = (get-cmdevice).name
foreach ($computer in $computers)
{
try
{
Get-ADComputer -Identity $computer -ErrorAction Stop >$null
}
catch
{
write-host “$computer is not in AD”
}

}


Comments

This post is locked
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ