Home Forums Programming Powershell Invoke-ASCMD - Passing values to the XMLA file not working RE: Invoke-ASCMD - Passing values to the XMLA file not working

  • Hi,

    I am not very good at the old command line, if the solution can be all in PowerShell, then I might be able to help.

    First of all, I am not able to test this in a real environment as I do not have the SSAS installed in my computer and I have never used the Invoke-ASCmd cmdlet, so I will be using the cmdlet as you typed in your post - assuming it is correct, although instead of using the parameter -InputFile, I will use the parameter -Query, based on the description in HERE.

    $DBNAME = "ANALYSIS_DB";

    $SCRIPTPATH = "E:\cube_backup.xmla";

    $SRC = "ServerName\ServerInstance";

    $BACKUPPATH = "G:\Cube_BackupFolder";

    $date = Get-Date -Format "yyyyMMdd_hhmmtt";

    $BACKUPFILE = "$BACKUPPATH\$($DBNAME)_cube_$date.abf";

    $query = @"

    <Backup xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">

    <Object><DatabaseID>$DBNAME</DatabaseID></Object><File>$BACKUPFILE</File>

    <AllowOverwrite>false</AllowOverwrite>

    </Backup>

    "@;

    Write-Host "Invoke-ASCmd -Query `"$query`" -Server `"$SRC`"";

    Invoke-ASCmd -Query $query -Server $SRC