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

 
Participant
2 years, 9 months ago.

  • Author
    Posts
  • #33326

    Participant
    Points: 0
    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

    Participant
    Points: 0
    Rank: Member

    compare array1 array2

    ex.

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

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