I am trying to run a diff of two files using Compare-Object cmdlet and print the ones missing in the second file (slave.txt) when compared to the first file (master.txt). In this example, I wanted to print user1, user3 which are in master.txt but not present in slave.txt. I have a pre-requisite of storing each values in the file as a variable, so "mobj" and "sobj" cannot be ignored.

I am finding this error when running the script. what could be the issue here?

```
~]# cat master.txt
user1
user2
user3

~]# cat slave.txt
user2
user4

```

Code:

```
$mfile = Get-Content "C:\master.txt"
$sfile = Get-Content "C:\slave.txt" 
foreach ($mobj in $mfile) {

foreach($sobj in $sfile){
        Compare-Object (ls $mobj) (ls $sobj) -Property Name, Length, LastWriteTime -passthru | Where { $_.PSParentPath -eq (gi $mobj).PSPath } 

    }
}

```

The error reported is:

```
Compare-Object : Cannot bind argument to parameter 'ReferenceObject' because it is null.

```