Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

Reply To: Exclude results of a compare-object if they meet a specific criteria

$
0
0

Ok here is a working code sample:

$today = [DateTime]::Today.ToString("MM-dd-yyyy")
$yesterday = [DateTime]::Today.AddDays(-1).ToString("MM-dd-yyyy")
$yesterdays = Import-Csv -Path ($yesterday +".csv")
$todays = Import-Csv -Path ($today +".csv")
$getquota = $today +"_Add_Quota.csv"

compare-object $yesterdays $todays -Property EMPLID,GROUP_NAME -PassThru|?{$_.SideIndicator -eq '=>'}|
?{$_.GROUP_Name -eq 'FacStaffStudents14Spring' -or $_.GROUP_Name -eq 'Students14Spring'} | select * -ExcludeProperty MIDDLE_INITIAL,SideIndicator| Export-Csv $getquota -NoTypeInformation


Viewing all articles
Browse latest Browse all 13067

Trending Articles