Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

SSAS DB Backup Error w/ PowerShell (Access is Denied) Expand / Collapse
Author
Message
Posted Tuesday, January 07, 2014 8:27 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, April 11, 2014 9:17 AM
Points: 2, Visits: 38
Hello,

I am trying to help automate our nightly backups for our test SSAS servers with PowerShell. The code I am using enumerates through all of the databases on a specific SSAS instance and backs up the databases to a specified location. The script works great for some instances but it errors out for others. For the ones it works great for, it connects, backs up all of the databases, and write success messages to the console. However, for some other instances, the script connects, attempts to backup the database, and fails to backup with the following PowerShell error message:

"Exception calling "Backup" with "1" argument(s): "The following error occurred during a file operation: Access is denied.(\\Server\backup_test\test_01.07.2014.07.31.32.abf)."


The code I am using for the backups is as follows:

$server = New-Object Microsoft.AnalysisServices.Server
$server.Connect($server_instance)
$dbs = $server.Databases

foreach($db in $dbs){
try{
$dt = Get-Date -f _MM.dd.yyyy.HH.mm.ss
$fileName = $("$filePath\$db$dt.abf")
LogWrite $("----Backing up the file: "+$fileName)
$db.Backup($fileName)
}
catch{
LogWrite $("ERROR --> There was an error when attempting to backup the db: " + $db)
LogWrite $_
}

The script is being run through SQL Agent under an account that has full admin permission to all of the SSAS instances. What strikes me as odd is some instances work just fine while only a handful of instances receive these errors. Can anyone help me figure this out?
Post #1528518
Posted Friday, February 07, 2014 8:22 AM


Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, April 17, 2014 1:51 AM
Points: 17, Visits: 2,237
I'm not using powershell; but use the agent on the associated SQL Server with SQL Server Analysis command option. It executes under the SQL Server Agent Service Account as default... So just a thought in case the powershell operates in the same way. If you are not using the same account to manage all instances of SQL then confirm that each account has sufficient R\W permissions on the backup share.

Post #1539221
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse