Comparing two arrays


hey guys,

so made script takes pre-defined list of software ($junk) contained in out standard image , compares function's output ($inq). resulting output list of software not defined in $junk. part works beautifully. few entries making in through , not sure why other 90% of $junk array gone.

function get-remoteprogram {...}    $computer = ""  $computer = read-host "enter device prefield"     get-remoteprogram -computername $computer | select -property programname | ft -hidetableheaders | out-file "c:\temp\file-out.txt"  $inq = @(get-content "c:\temp\file-out.txt")  $junk = @(get-content "\\networkpath\pre-field.txt")    $inq | {$junk -notcontains $_} | sort -unique

the looks little this:


take winzip 20.0. can see listed in both files, 1 of few programs making through.

any recommendations?

plot twist: seems have way made original pre-field.txt file ($junk). copied output powershell window , pasted text file. apparently that's bad way it.

this time, took file-out.txt ($inq), deleted lines of don't want filtered out , saved pre-field.txt ($junk) & presto... output. curious... guess have careful how add new items file moving forward.

however aforementioned -expandproperty methodology mentioned by bofh_666 is still bust me.





Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

server manager error: ADAM.events.xml could not be enumerated.

Cannot access Anywhere Access using domain name?

WMI Failure: Unable to update Local Resource Group