Compare values in two array

Welcome Forums General PowerShell Q&A Compare values in two array

This topic contains 1 reply, has 2 voices, and was last updated by

3 years, 4 months ago.

  • Author
  • #33326

    Topics: 13
    Replies: 11
    Points: 32
    Rank: Member

    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

    Topics: 17
    Replies: 573
    Points: 21
    Rank: Member

    compare array1 array2


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

The topic ‘Compare values in two array’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort