Compare a .csv list of computer names against what's present in Azure

I have a list of computers in a .csv file (over 200) from our local AD and want to compare it to current Azure devices if they are present and export the result as a csv file

Using $list = Import-csv - I’m not sure how to compare it to and active Azure device list and never used the Compare-Object cmdlet. Any assistance would be appreciated - thanks in advance

What have you tried so far? Please show your code. I assume $list = Import-csv is not all you have. :wink:

A general recommendation: You should always read the help for the cmdlets you’re about to use COMPLETELY INCLUDING THE EXAMPLES to learn how to use them:

1 Like
$File1 = Import-Csv -Path "C:\AD.csv"
$File2 = Import-Csv -Path "C:\Azure.csv"
$Results = Compare-Object  $File1 $File2 -Property computer -IncludeEqual
$Array = @()       
Foreach($R in $Results)
    If( $R.sideindicator -eq "==" )
        $Object = [pscustomobject][ordered] @{
            Computer = $
            "Compare indicator" = $R.sideindicator
        $Array += $Object
($Array | sort-object computer | Select-Object * -Unique).count

You did not share any sample data from the input files.

But apart from the fact that I don’t understand why you need a loop - what’s the issue? What’s your question?

Thank you for your responses. Have a nice day.

I don’t get it. :man_shrugging:t3:

Did you solve your isssue? :thinking: