Automation of TaskAudit and DataAudit in
HFM
Table of Contents
1. Introduction
2. Scheduling the Command Script via Task
Scheduler
3. Invoking the Main Script
TaskAudit_Email_Final.cmd
4. Task and Data Audit Core Script
5. Powershell Script for sending Reports as
attachment
6. Archive Folder
7. Script Details
1.
Introduction
Task
and Data Audit is data which every organization need on particular timeframe.
In order to mitigate the risk to run over the Production Manual, script is been
used to run on the specific time which reduce the Manual Work Load and
intervention.
2.
Scheduling
the Command Script via Windows Task Scheduler
Using
the Windows Task Scheduler this script is scheduled to run the script every 1st of
Month at 6 AM.
Location
of Script: <Drive>:\TaskAuditAutomation
3.
Invoking
the Main Script TaskAudit_Email_Final.cmd
Task Scheduler is going
to invoke the TaskAudit_Email_Final.cmd script which consists of 2 scripts.
a) TaskAudit.cmd
b) final_sendemail.PS1
4.
Task
and Data Audit Core Script
TaskAudit.cmd is the core script which generate
the Task Audit and Data Audit in below mentioned folder. You can choose any
folder like <Drive>:\TaskAuditAutomation\Reports folder
Data Parameter is defined in TaskAudit.cmd which
will take last month 1st Day and last month last day, so that
it will satisfy the required of taking Task Audit and Data Audit for last
month.
5.
Powershell
Script for sending Reports as attachment
final_sendemail.PS1 is PowerShell script which will take the report
from the <Drive>:\TaskAuditAutomation\Reports folder and send to the desired recipients.
6.
Archive
Folder
Once the mail is sent then
TaskAudit_Email_Final.cmd script will archive the Reports which are generated
to <Drive>:\TaskAuditAutomation\Reports\Archive Folder.
7.
Script
Details
a. TaskAudit.cmd
<Drive>:\Oracle\Middleware\EPMSystem11R1\products\FinancialManagement\Utilities\hfmauditextractcmdline_x64.exe
-u "<Drive>:\Oracle\Middleware\EPMSystem11R1\products\FinancialManagement\Server
Working Folder\<HFM_Server>.udl" -d
<Drive>:\TaskAuditAutomation\Reports -a <HFM_Application_Name> -l;
-s %moon% -e %sun% -t Enabled -x Enabled
b. final_sendemail.PS1
$files=Get-ChildItem “<Drive>:\TaskAuditAutomation\Reports\”
| Where {-NOT $_.PSIsContainer}
$smtpServer = "(Exchange Server or MailBox Server Name)"
$msg = new-object Net.Mail.MailMessage
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$msg.From = "Your email id or Mailbox id"
$msg.To.Add("Your email id or Receipent Email id")
$msg.Subject = "TaskAudit and DataAudit Report"
$msg.Body = "<b>Greeting for the
day!!!</b><br><br><br>Please find the attachment for
the TaskAudit and DataAudit for the last month
<b>$Server</b><br><br><br> Have a Nice DAY!
<br><br><br>Best Regards, <br>Hyperion Team"
$msg.IsBodyHtml = 1
Foreach($file in $files)
{
Write-Host “Attaching File :- ” $file
$attachment = New-Object Net.Mail.Attachment –ArgumentList
<Drive>:\TaskAuditAutomation\Reports\$file
$msg.Attachments.Add($attachment)
}
$smtp.Send($msg)
$attachment.Dispose()
$msg.Dispose()
c. TaskAudit_Email_Final.cmd
echo off
call <Drive>:\TaskAuditAutomation\TaskAudit.cmd
Timeout /t 5
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "&
'<Drive>:\TaskAuditAutomation\final_sendemail'"
Timeout /t 5
move <Drive>:\TaskAuditAutomation\Reports\*.*
<Drive>:\TaskAuditAutomation\Reports\Archive
No comments:
Post a Comment