0

I am trying to execute axbuild.exe ( new 64-bit compiler for Dynamics AX ) via powershell in noninteractive mode and it loads the first screen but then the process ends.

When running from windows command line, the first screen opens, closes, and then a few seconds later a number of worker processes spawn and process the entire X++ compile.

Any thoughts?? Suggestions?

Jan B. Kjeldsen
  • 17,817
  • 5
  • 32
  • 50
silvanod
  • 1
  • 1

2 Answers2

1

I've been having troubles with Start-Process (with elevated privileges), but recently I switched to the & command and it runs like a charm, this way:

$axBuild = Join-Path $axServerBin "\AxBuild.exe"
$axCompiler = Join-Path $axServerBin "\ax32serv.exe"
& $axBuild 'xppcompileall' /compiler="$axCompiler" /log="$scriptPath" /altbin="$axClientbin"
j.a.estevan
  • 3,057
  • 18
  • 32
0

You have to run the axbuild.exe with elevated privileges (Run as Administrator).

If you are starting the caller process from the Task Scheduler you have to tick the Run with highest privileges option.

Task Scheduler - Run with highest privileges


Within the powershell you can execute Start-Process AxBuild.exe -Verb RunAs.

You can verify Administrator privilege with the next code snippet:

([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")

See PowerShell: Running a command as Administrator for example.

Community
  • 1
  • 1
Matej
  • 7,517
  • 2
  • 36
  • 45
  • I'm running this in TeamCity, does it require anything additional? It is executing the following: Starting: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -ExecutionPolicy Bypass -File "C:\Program Files (x86)\TeamCity\buildAgent\temp\buildTmp\powershell2280810545960782468.ps1" – silvanod Nov 01 '14 at 12:13
  • The same script works great when I run it manually on the same machine as the same user, with the -Verb RunAs. But even with that extra switch in the script, it won't work when run via TeamCity. – silvanod Nov 01 '14 at 12:14