SSAS Cube or Database backup with Powershell command "Backup-AsDatabase"

Run the full code from Load assembly section.
# Load the assembly
#[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices") | Out-Null
# Create the server object
$server = New-Object Microsoft.AnalysisServices.Server
$server.Connect("localhost")  # Or your SSAS instance name
 #Date Converion with minutes and seconds
 $date = (get-date).ToString("MM_dd_yyyy_hh_mm_ss")
 $Server = New-Object Microsoft.AnalysisServices.Server
 $Server.Connect("MAPS\TEST")
 $dbservers = $Server.Databases|Select-Object Name,ParentServer
 $dbservers|ForEach-Object{
 $inddb = $_
 #The "Backup-AsDatabase" is especially for SSAS cube backup and downloaded from "SQLServer" powershell module
 Backup-ASDatabase -BackupFile "E:\MAPS_TEST\SSAS_BACKUP\NEW\$($inddb.Name)_$($date).abf" -Name $inddb.Name -Verbose -Server $inddb.ParentServer
 Write-Host "SSAS cube backup [$($inddb.Name)] completed successfully on server [$($inddb.ParentServer)]"
 Write-Output "SSAS cube backup [$($inddb.Name)] completed successfully on server [$($inddb.ParentServer)]"
 }

Comments

Popular posts from this blog

System.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out

Always On FailOver Events

The transaction log for database is full due to 'OLDEST_PAGE'