Skip to content

Instantly share code, notes, and snippets.

Created June 9, 2016 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/e8d40244a299a425802763f568fb04af to your computer and use it in GitHub Desktop.
Save anonymous/e8d40244a299a425802763f568fb04af to your computer and use it in GitHub Desktop.
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