I've said before that I'm really impressed with ascmd.exe however I've just come across a problem in the documentation that has held me up for a while.
ascmd allows you to parameterize xmla scripts from the command-line using the -v option. This is really useful as it means you could, for example, use the same script to process any cube and just parameterize the script with the name of the cube.
The documentation states the following:
Using System-Reserved Scripting Variables in Scripts, Queries, or Statements
System-defined scripting variables can also be used within an XMLA script, an MDX query, or a DMX statement. The following examples illustrate sample command-line invocations of the ascmd command-line utility that use scripting variables. More complete examples appear later in this document to illustrate usage scenarios.
- C:\>ascmd –S <server name> –i process.xmla -v cube=<CubeID>
process.xmla (simplified)
<Batch>
<Parallel>
<Process>
<Object>
<DatabaseID>($ASCMDDBNAME)</DatabaseID>
<CubeID>($CUBE)</CubeID>
. . .
</Process>
</Parallel>
</Batch>
If you take that command-line and script and try and plug it into your own environment however it won't work. Why? Quite simply its because you define a parameter in an XMLA script using the syntax $(ParamName), and NOT ($ParamName) as as has been stated above.
Hopefully that will save you the time that I've just spent finding it out for myself! I have told Microsoft about the error using the feedback link at the bottom of the readme so by the time you come to read this it might have been corrected!
-Jamie