Running ax batch jobs in command line

Hello Everyone,

Is there any possibilty to stop and start ax batch jobs in running ax session using command?

Can you elaborate your requirements? What “starting” and “stopping” means for you? Changing the status?

What’s your version of AX?

Hi Martin,

Is it possible to get a command to start and stop batch jobs(changing status) in running Ax application. My Ax version is 4.0 SP2.

Hi Martin,

My requirement is, Ax batch jobs sometimes stop processing files from a location because of db connectivity issues. So we need a command line to start the stopped batch jobs in running application. Is it possible to do in Ax 4.0 SP2?

Everything is possible with a piece of code. [:)]

I would use Business Connector and call it directly from Powershell. This is how I opened AX 2009 BC in Powershell:

$connectorDllPath = 'C:\Program Files\Microsoft Dynamics AX\50\' `
    + 'Client\Bin\Microsoft.Dynamics.BusinessConnectorNet.dll'
$configFile = …

try
{
    [void][reflection.Assembly]::Loadfile($connectorDllPath)
    $ax = New-Object Microsoft.Dynamics.BusinessConnectorNet.Axapta
    $ax.logon('', '', '', $configFile)
}

Hi Martin,

Thank you. May I know how does it work? What is the purpose of $configFile?

I used $configFile to point to a specific .axc file. You don’t need it if you want to use the default AX configuration.

Here is the MSDN documentation for Logon().