How to make the ascmd utility working in SSAS 2008R2

To make ascmd working is a little bit different from other cmd utilitites. You cannot download an executable program for ascmd, neither ascmd.exe is given to you directly. You have to first build the ascmd.exe by yourself, and then use it.

Step 1: Download and install the appropriate sample project (e.g., SqlServerSamples.msi for SQL Server 2005 SP2, or AdventureWorks 2008R2 Analysis Services Project.zip for SQL Server 2008R2)

The ascmd utility is included as a part of the sample project. You need to download the proper sample project first (for 2005 SP2, 2008 and 2008 R2). I have the R2 samples installed in  F:\Program Files\Microsoft SQL Server\100\Samples\Analysis Services\Administrator\ascmd

Step 2: Generate a strong name key file
  • Open a Microsoft Visual Studio 2008 command prompt as below: 
Click Start, point to All Programs, point to Microsoft Visual Studio 2008, point to Visual Studio Tools and then click Visual Studio Command Prompt.
  • Use the change directory command (CD) to change the current directory of the command prompt window to the folder where the samples are installed.
Note:If the default installation location was used, the samples are located in :\Program Files\Microsoft SQL Server\100\Samples 
At the command prompt, run the following command to generate the key file:sn -k SampleKey.snk
Step 3 - Build the ascmd.exe utility

After generating the strong name key file, build the sample using the following instructions.
  1. In Visual Studio, From the File | Open menu, click Project and open the solution file ascmd.sln.
  2. From the Build menu, click Build ASCMD. The ascmd.exe file is created now!
Step 4 - to test the ascmd.exe utility (note the . between -S and -i)
F:\Program Files\Microsoft SQL Server\100\Samples\Analysis Services\Administrator\ascmd\CS\ascmd\bin\Debug\ascmd -S . -i d:\backupMD.xmla
(I have created a backupMD.xmla file as below to backup the Adventure Works DW 2008R2 database to the D drive)
   D:\Analysis Services Tutorial.abf

In SQL Server 2012, this old-fashion command can be replaced by the Revoke-ASCmd commandlet in PowerShell.