Tags
Automation, AutoRun, AX, AX 2012, Build Scripts, Database, DB, Dynamics AX, PowerShell, Synchronize
The Sync-AXDB custom PowerShell function will allow you to synchronize the AX DataDictionary from PowerShell. If you compare this function/post against the Compile-AXCIL function/post, you will see that they are almost identical. I had thought of creating a single Start-AXAutoRun function but eventually scrapped that idea in favor of simplicity for the user. I may look at creating an internal function for the AX call at some point in the future to remove the code duplication.
The Sync-AXDB function takes between 1 and 7 parameters:
- ConfigPath (Client configuration for the chosen AX environment)
- LogFile (The value defaults to the temp folder but can be overridden if desired)
- TimeOut (The value defaults to 2 hours but can be overridden if desired)
- SMTPServer (SMTP server to use to send the email)
- MailMsg (Net.Mail.MailMessage object used to send the email)
- AXVersion (The AX version. It defaults to 6.)
- VariablePath (Path to a file used to default the parameters/variables)
I use the VariablePath parameter the same way that I do in the other functions I’ve posted that use it. This function can be found in Codeplex. The steps of this function are:
- Load the variables if a VariablePath parameter is used
- Get the AX environment info using Get-AXConfig
- Get the Synchronize AX AutoRun xml using the Get-AXAutoRunXML function
- Call the Start-AXAutoRun function to synchronize the database
This function should also only be run on the AOS server. It has been tested using AX 2012 R2 CU7 but should also work for R3. I have added the Version parameter to this function but it was initially missing from the Compile-AXCIL function/post. I have gone back and added it to the earlier post as well to reflect the code change in TFS.
Pingback: D2DDynamics custom PowerShell module | Day 2 Day Dynamics
Pingback: Build-AXModel custom PowerShell function | Day 2 Day Dynamics
Pingback: Push-AXModel custom PowerShell function | Day 2 Day Dynamics