, , , , , ,

This blog post is an extra this week.  In my last blog post, I discussed my desire to clean up the duplicate code in my functions that were calling the AXAutoRun process.  This function is putting that duplicate code into a single function that my other functions will call.  I will update the code and blog posts to reflect this change.  I apologize for the changes but these functions are a work in progress.  I have been using them for over a year but one of the main reasons I wanted to blog about them was so I could clean them up and package them for others.

The Start-AXAutoRun function takes between 5 and 8 parameters

  • Ax (The PSObject returned from the Get-AXConfig DynamicsAXCommunity function)
  • Model (The AX model to open in)
  • XMLFile (The xml generated from the Get-AXAutoRunXML function)
  • LogFile (The location of the log file)
  • Process (A description of the process being run that is used for notifications)
  • Timeout (The timeout value for the process in seconds)
  • SMTPServer (SMTP server to use to send the email)
  • MailMsg (Net.Mail.MailMessage object used to send the email)

This function can be found in Codeplex.  The steps of this function are:

  • Start the AX client using the AutoRun xml
  • Wait for the timeout period for the AX client to exit
  • Send the success/fail message

The first 5 parameters are required.  The last 2 are only necessary for emailing the results.  I’m not expecting that most users would be using this function as it is intended to be an internal function used by my custom functions that call AXAutoRun.  Using this in hand with Get-AXAutoRunXML would allow you to build any custom AXAutoRun functions that you would like however.