Error on running automated Tableau backup using TSM in Powershell


I am trying to automate Tableau backup in Windows. I am using Tableau 2019.1. As the new TSM command requires a password every time we do backup, what I did was I stored the password on another file and encrypt it, and call this file when I want to execute the command. Instead of using .bat file, I use PowerShell because I am calling the credentials '.sec' file via PowerShell (I am not sure on how to do it on .bat).

Below are the sample code that I did ("MyP@ssword1" is not my real password, and the tableau backup script is what I found somewhere from Tableau community):

To encrypt password (I put it on C:\Users\Administrator.tableau\cred.sec):

"MyP@ssword1" | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom- 
 SecureString | Out-File "c:\Users\BackupAdmin\.tableau\cred.sec"

My ps1 file:

$FilePath = "C:\Users\Administrator\.tableau\cred.sec"

$Username = "my username"

$encryptedCred = Get-Content $FilePath | ConvertTo-SecureString

$cred = New-Object$Username,             


$Pass = $cred.GetNetworkCredential().Password

$a=Get-Date -UFormat "%y/%m/%d"

tsm maintenance backup -f ts_backup -d -u "$Username" -p "$Pass"

$Pass = ""

tsm maintenance ziplogs -l -t -o -f "logs-$a .zip" -u "$Username" -p "$Pass"

$Pass = ""

On windows task scheduler,

On Actions: start a program

program/script: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

arguments: ".\tableau_backup.ps1"

start in: ""D:\Tableau Server\data\""

The error message is: "the operator or administrator has refused the request (0x800710e0)" from windows task scheduler, but if I 'run with PowerShell', this script is working as normal.

I am not sure which part that I did wrong, would someone can advise me on this?

Thanks for your help in advance.

asked on Stack Overflow Mar 27, 2019 by bella • edited Mar 27, 2019 by boxdog

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0