Compare values in two array

This topic contains 1 reply, has 2 voices, and was last updated by  Dan Potter 1 year, 10 months ago.

  • Author
    Posts
  • #33326

    Sachin Ghagare
    Participant

    Hey guys,

    I'm newbie to Powershell.

    My objective is to compare AD sites and Configuration Manager (SCCM) boundaries using powershell.....below is the code to get site and boundary info from ad and sccm. How do i compare resultant values/sites which are exists in AD and not exists in SCCM and vice-versa?

    Any help is appreciated...!
    ——————————————————————
    # Get AD Sites list from current domain
    $ADSites = @($configNCDN = (Get-ADRootDSE).ConfigurationNamingContext
    $siteContainerDN = ("CN=Sites," + $configNCDN)
    Get-ADObject -SearchBase $siteContainerDN -filter { objectClass -eq "site" } | select name )

    # Import SCCM module and get boundaries
    $CMBoundary = @(Import-Module 'C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1'
    CD P01:
    Get-CMBoundary | select value)

    ————————————————————-

  • #33340

    Dan Potter
    Participant

    compare array1 array2

    ex.

    compare (get-adforest).sites ((get-adforest).sites | select -Skip 4) -includeequal

You must be logged in to reply to this topic.