I have csv files with wsus raport ( there are server names ) I have also txt file with server names which are in my scope.
I would like remove entry from my csv files if not match txt files.
I found solution how to to something appositive ( keep lines if match)
$SourceFile = 'C:\temp\wsus.csv'
$scope = Get-Content C:\Temp\windows_server.txt
foreach ($Pattern in $scope)
{
(Get-Content $SourceFile) | Where-Object { $_ -notmatch $Pattern } | Set-Content $SourceFile
}
I was hopping that I change -notmatch to -match and it will work but doesn't.
Best Regards, Krzysztof