RSA Authentication Manager User Auditing

RSA Authentication Manager exports the list of users and SecurID fobs in a text format with multiline records.  Moreover, if the user does not have a SecurID, the number of fields displayed is truncated.  Fortunately, .CSV will gladly accept 'short' records.  Here is a way to convert the User.DMP file that lists all users in the RSA Authentication Manager DB, and their fobs if present:

 

param (

[string]$dmpPath = "$home\desktop\users.dmp",

[string]$csvPath = $null

 

if (!(Test-Path $dmpPath)) { Write-Error "-dmpPath $dmpPath not found"; }

if (!$csvPath) { $csvPath = "$dmpPath.csv";

 

& {

      '"FullName","UserName","FobId","LoginDate","LoginTime","TokenType"'

      $buffer = $null; 

      gc $dmpPath | % {

            $line = $_ -replace "[\s]+", " ";

            if (($line -match '->') -or ($line -match '^\s*$')) {

                  $line = $line -replace "\s+", "`t";

                  $buffer += "`t$line";

                  if (

                        !($buffer -match "^\s*User\s+Name") -and

                        !($buffer -match "^\s*User\s+Report") -and

                        !($buffer -match "^\s*$")

                  ) {

                        $buffer -replace "\s+->\s+", "`t" -replace "Key`tFob", "Key Fob" -replace "^", '"' -replace "`t", '","' -replace "$", '"';

                  }

                  $buffer = $null;

            } else {

                  $line = $line -replace "\s+(\S+)\s*$", "`t`$1";

                  $buffer += "$line`t";

            }

      }

} | Set-Content $csvPath -Encoding ascii;