/blog-ADSystemDiscovery.ps1 Secret
Created
February 17, 2014 13:27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#region AD System Discovery | |
#Set the System Discovery | |
$Schedule = New-CMSchedule -Start "2014/02/13 20:20:00" -RecurInterval minutes -RecurCount 10 | |
Set-CMDiscoveryMethod -SiteCode DEX -ActiveDirectorySystemDiscovery -Enabled $true -EnableFilteringExpiredLogon $true -TimeSinceLastLogonDays 90 -EnableFilteringExpiredPassword $true -TimeSinceLastPasswordUpdateDays 90 -PollingSchedule $Schedule | |
#To set the AD Containers | |
$Sysdiscovery = get-ciminstance -classname SMS_SCI_Component -filter 'componentname ="sms_ad_system_discovery_agent"' | |
$ADContainerProp =$Sysdiscovery.PropLists | where {$_.PropertyListName -eq "AD Containers" } | |
$ADContainerProp.Values = "LDAP://CN=System,DC=Dexter,DC=Com",1,1 # Ldap path of the Container, Recursive search, Discover objects within groups | |
#set the changes back to the CIM Instance | |
Get-CimInstance -classname SMS_SCI_Component -filter 'componentname ="sms_ad_system_discovery_agent"' | Set-CimInstance -Property @{PropLists=$Sysdiscovery.PropLists} | |
#need to restart the Service | |
(Get-Service SMS_SITE_COMPONENT_MANAGER -ComputerName dexsccm).stop() | |
Start-Sleep -Seconds 10 | |
(Get-Service SMS_SITE_COMPONENT_MANAGER -ComputerName dexsccm).start() | |
#endregion AD System Discovery | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment