Often there are various build processes or other automated tasks that run via PowerShell and need to be run as administrator. If you forget to run it as administrator, it won't work, and you don't always know.
I came across a great blog post by Ben Armstrong that I have to share, where he's created a block of code you just prefix to the beginning of your PowerShell script that will re-launch it as administrator if it is not. Check his post out here:
http://blogs.msdn.com/b/virtual_pc_guy/archive/2010/09/23/a-self-elevating-powershell-script.aspx
Here's a screenshot of the PowerShell code in case his blog goes down:
This technical blog will be about my adventures with Microsoft Dynamics 365 for Operations (AX7/D3fo), AX 2012, and AX 2009.
Wednesday, October 28, 2015
Tuesday, October 13, 2015
Without any customization, how to incrementally compile the CIL from the command line
With Dynamics AX 2012, you can start an incremental CIL compile from the command line (or Power Shell) without any customization. This is useful if you have any automated processes that import XPOs frequently and you don't want to constantly build the full CIL.
Create an XML file with this data:
Then save it in a place that is accessible from the AOS service account. I saved it as "C:\IncrementalCIL.xml" on the AOS machine.
Then run this command, subbing in for your environment:
"C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin\Ax32.exe" \\MyNetworkShare\AOS.axc -startupcmd=autorun_C:\IncrementalCIL.xml
Some notes about the XML. The version attribute must not be greater than your system's build, which can be found from calling xInfo::releaseVersion().
There are a TON more autorun features available, and you can use the following links or just dig into \Classes\SysAutoRun.
More information can be found at:
Create an XML file with this data:
<?xml version="1.0" ?> <AxaptaAutoRun exitWhenDone="true" version="6.2" logFile="C:\AxaptaAutorun.log"> <CompileIL incremental="true" /> </AxaptaAutoRun>
Then save it in a place that is accessible from the AOS service account. I saved it as "C:\IncrementalCIL.xml" on the AOS machine.
Then run this command, subbing in for your environment:
"C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin\Ax32.exe" \\MyNetworkShare\AOS.axc -startupcmd=autorun_C:\IncrementalCIL.xml
Some notes about the XML. The version attribute must not be greater than your system's build, which can be found from calling xInfo::releaseVersion().
There are a TON more autorun features available, and you can use the following links or just dig into \Classes\SysAutoRun.
More information can be found at:
- https://msdn.microsoft.com/en-us/library/sysautorun.aspx
- https://msdn.microsoft.com/en-us/library/aa569641.aspx
Subscribe to:
Posts (Atom)