Tabcmd refreshextracts using PowerShell
Tracy Mixa Aug 10, 2016 12:27 PMI have PowerShell scripts set up to refresh extracts on our Tableau server. These scripts are kicked off via our scheduling app, ASG ZENA, after its parent process completes. I have had this working for awhile now, but I've had to edit the script to point to a different site (but still on the same server). Now I receive an error saying "Cannot sign in because of missing arguments: --username,--certificate,--server". As you can see in my script below, the information is provided during the 'login' process. Can someone provide some insight?
# Set Tableau Parameters $ErrorLevel = $LASTEXITCODE $user = 'username' $server = 'tableau.company.com' $site = 'company site' $project = 'project name' $datasource = 'data source name' $ZENA = 'ZENA task name' # Set Email Notification Parameters $PSEmailServer = 'mail.company.com' $NoReply = 'NoReplyTableau@company.com' $ToEmail = 'user@company.com' $TabAdmin = 'TableauAdmin@company.com' $SuccessSubject = $ZENA + '-' + $datasource + 'Refresh Completed Successfully' $FailureSubject = $ZENA + '-' + $datasource + 'Refresh Failed' $FBody = $datasource + ' failed to refresh. Please contact TableauAdmin@company.com' # Read Secure Password from File and Return Plain Text function ConvertFrom-SecureToPlain { $TabcmdPassword = get-content 'D:\pathtopasswordfile\storedPassword.txt' | Convertto-SecureString $credential = new-object system.management.automation.pscredential($user,$TabcmdPassword) $TabcmdPassword = $credential.getnetworkcredential().password Return $TabcmdPassword } $TabcmdPassword = ConvertFrom-SecureToPlain # Set the Tabcmd Directory $TabCmd = "D:\Program Files\Tableau\Tableau Server\9.3\bin\tabcmd.exe" # Log into the Server and Site & $TabCmd login -s $server -t $site -u $user -p $TabcmdPassword --no-certcheck # Refresh Relevant Extracts and Log Out & $TabCmd refreshextracts --project $project --datasource $datasource --synchronous --no-certcheck $ErrorLevel = $LASTEXITCODE & $TabCmd logout # Send Appropriate Failure or Success Email Based on LASTEXITCODE if ($ErrorLevel -eq 0) { Send-MailMessage -From $NoReply -To $ToEmail -Subject $SuccessSubject exit 0 } else { Send-MailMessage -From $NoReply -To $ToEmail -Cc $TabAdmin -Subject $FailureSubject -Body $FBody exit 1 }