This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Possible to attached Workflow output as CSV?

Hi,

I'm using a scheduled Workflow to first locate and then deprovision inactive user accounts in AD. By itself the Workflow is fine (only using native tasks) and with the option enabled to "Attach a report of workflow execution to notification message", I receive a little HTML file with the overview of what happened, which accounts were found etc etc. Unfortunately, in their efforts to make the HTML "look nice", its kind of lost its functionality as a "raw output file". In other words, the HTML isn't that easy for administrators looking to create a quick overview or transfer results into Excel file etc

My question is whether or not it would be possible to have the output of the initial Query delivered/exported as a CSV file? So just to have a few values of each account (username etc) in a CSV? Best would be to have that file delivered along with a "Workflow has been executed successfully" message.

Thanks in advance for your help! Best regards,

Michiel

 

PS: Running ARS v6.9

Parents
  • If you are using a Search activity to find the users to deprovision, you just need a very simple bit of code to export that list.

    You would create a script module that receives the user info from the Search.

    Now the tricky bit of that is how the Search activity transfers the users - they are in an object called "workflow.FoundObject".

    Suppose your Search is called "Find Users to Deprov"

    Here's a very simple script that you can pair with your Search activity:

    Function ExportFoundUsers ($Request)
    {

    $UserDN = $workflow.FoundObject("Find Users to Deprov").get("distinguishedName")

    # Write the user DN to a file
    Add-Content -Path "DeprovedUsers.txt" -Value $UserDN
     
    }

    You take the above code and place it into an ActiveRoles Policy script which you create in the Script Modules section of the AR MMC.

    The above code is called for each user found. You will need to make sure that you place the script activity inside the gray box that surrounds the Search activity in the workflow.

    The code to send the file would be something like this:

    Function SendOutFile

    {

    # E-mail the file to someone

    $NotifiedUser = "Administrator@company.com"

    Send-MailMessage -From "ActiveRoles@company.com" -To "Admin@company.com" -Attachments "DeprovedUsers.txt"`
    -Subject "Deproved User List" -Body "See attached list of deproved users" -SmtpServer "Mymailserver.company.com"

    }

    You can put this in a script activity that is outside of the Search's gray box. 

Reply
  • If you are using a Search activity to find the users to deprovision, you just need a very simple bit of code to export that list.

    You would create a script module that receives the user info from the Search.

    Now the tricky bit of that is how the Search activity transfers the users - they are in an object called "workflow.FoundObject".

    Suppose your Search is called "Find Users to Deprov"

    Here's a very simple script that you can pair with your Search activity:

    Function ExportFoundUsers ($Request)
    {

    $UserDN = $workflow.FoundObject("Find Users to Deprov").get("distinguishedName")

    # Write the user DN to a file
    Add-Content -Path "DeprovedUsers.txt" -Value $UserDN
     
    }

    You take the above code and place it into an ActiveRoles Policy script which you create in the Script Modules section of the AR MMC.

    The above code is called for each user found. You will need to make sure that you place the script activity inside the gray box that surrounds the Search activity in the workflow.

    The code to send the file would be something like this:

    Function SendOutFile

    {

    # E-mail the file to someone

    $NotifiedUser = "Administrator@company.com"

    Send-MailMessage -From "ActiveRoles@company.com" -To "Admin@company.com" -Attachments "DeprovedUsers.txt"`
    -Subject "Deproved User List" -Body "See attached list of deproved users" -SmtpServer "Mymailserver.company.com"

    }

    You can put this in a script activity that is outside of the Search's gray box. 

Children
No Data