Skip to content

Instantly share code, notes, and snippets.

Created Jun 9, 2016
Embed
What would you like to do?
statuschange
$Past = Import-csv "Past.csv" | select Stig, Vkey, Status
$Current = import-csv "Current.csv" | select Stig, Vkey, Status
$AssignedNumbers = @()
ForEach ($key in $Past)
{
$vkey = $key.vkey
$stig =$key.stig
$status = $key.status
foreach($key2 in $current)
{
$status2 = $key2.Status
$stig2 = $key2.stig
$vkey2 = $key2.Vkey
}
If (($status -match 'Open') -AND ($status2 -notmatch 'Open'))
{
$AssignedNumbers += New-Object PsObject -Property @{STIG=$stig;Vkey =$Vkey;Status =$status2}
}
Elseif (($status -match 'closed') -AND ($status2 -match 'Open'))
{
$AssignedNumbers += New-Object PsObject -Property @{STIG=$stig;Vkey =$Vkey;Status =$status2}
}
}
$AssignedNumbers | select "stig","vkey","status"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment