Repository of Powershell Scripts for Tableau
All scripts are 'as is', and can be freely distributed.
No support is implied or offered.
Repository of Powershell Scripts for Tableau
Hi Glen,
When i run a script in powershel on the statement bellow I get an error.
Please advice. I'm not a super programmer in powershell. Maybe I do something wrong...
I need to get the tableau userid and the single method that I can use is the one bellow.
$response = Invoke-RestMethod -Uri $server/api/$api_ver/sites/$siteID/users?filter=name:eq:$username -Headers $headers -Method Get
`Invoke-RestMethod : 'utf8' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.
Parameter name: name
At C:\Users\msso.admin\Documents\WindowsPowerShell\Scripts\change_users_password.ps1:33 char:14
$response = Invoke-RestMethod -Uri $server/api/$api_ver/sites/$siteID/users?fil ...
+ CategoryInfo : NotSpecified: (:) [Invoke-RestMethod], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand`
There is a bug preventing changes to ViewDataSource permissions on TS-UpdateProjectPermissions.
If ($ViewDataSource -eq 'Allow' -or $ViewDataSource -eq 'Deny'){$DataSourceCapabilities += ' <capability name="Read" mode="' + $ViewWorkbook +'" />'}
Should be
If ($ViewDataSource -eq 'Allow' -or $ViewDataSource -eq 'Deny'){$DataSourceCapabilities += ' <capability name="Read" mode="' + $ViewDataSource +'" />'}
I've been trying to use your code to publish a workbook and it's not working. Can you confirm that this function works for you?
I've tried everything I can think of from using Invoke-RestMethod, double-checking my request, removing the connection credential and more. I can't seem to get a test workbook published.
Hi Glen, I've found your module library exceedingly helpful in developing a suite of tools around Tableau Server for my IT team colleagues.
I want to return the (blind) favour by supplying you a copy of my modified code as I've actually made quite a few changes including two new functions which implement chunked file upload for workbooks and data sources. So if you are interested in rolling the essence of these changes into your library baseline, I'm more than happy for you to do this :)
Also note I've added a C# block to improve System.Net.Webclient handling, and in my new functions have added some sanitizing around XML payloads.
Tableau-REST.psm1.txt
Best regards, Gavin.
I can't get TS-Signin to work. The signin-body appears to be malformed. I tried replacing the quotes but still can't get this to work. Keep getting the "Unable to Sign-In to Tableau Server" message.
Hi Glen!
Thanks a lot for your work with the powershell scripts for Tableau. I am using your Backup and restore stuff and I'm now trying to get the updateWorkbookpermissions to work (I want the workbook to change permissions depending which subproject it is in)
There seems to be something wrong with the GetgroupDetails function since it does not seem to return a GroupID that I need to run the updateworkbookpermissions. Do you know how to troubleshoot further?
Many thanks!
/Mats
Your library is great, thanks, thanks, thanks. I wonder if you can modify your sign in function to use with PAT. As you may know, Tableau Online have changed to enforce MFA. And the old sign in would not work, and I love to have PAT authentication.
Thanks.
Diego
Hi Glen,
Do you have an example of publishing a .hyper file, how should I call the TS-PublishDataSource ?
I got the following error when publishing .hyper on 2018.3
Unable to publish Data Source. Sample :- Exception calling "UploadString" with "3" argument(s): "The remote server returned an error: (502) Bad Gateway."
Here what I use:
TS-Signin -server $server -username $username -password $password -protocol https -siteID $SiteID
$RetStatus = TS-PublishDataSource -ProjectName Testing -DataSourceName Sample -DataSourceFile Sample.hyper -DataSourcePath C:\Batch\Input -UserAccount user -Password Pwd -Embed False -oAuth False -OverWrite False
TS-Signout
Thanks,
Lian
Hey Glen, this has been extremely helpful to us. One issue I'm currently facing is when exporting an excel crosstab when the view is blank. I know we can't download the excel file but I would like to be able to capture the error code. Do you know the syntax for capturing the 6 digit error code indicating the view is empty? I have tried using $.Exception.Message and $.ScriptStackTrace but it doesn't provide an accurate return value.
Thank you,
Jon
Getting this error while trying to publish a datasource or a workbook to tableau server
Unable to publish Data Source. test :- Exception calling "UploadString" with "3" argument(s): "The remote server returned an error: (400) Bad Request."
I am using the functions as specified in the helpfile. Any idea how to resolve this ?
TS-GetGroupDetails requires Domain, or defaults to local. There are other functions which use TS-GetGroupDetails in order to carry out their tasks (IE: TS-UpdateProjectPermissions) but those functions don't take a domain input, so if your not using local groups these functions don't work properly.
Quick and dirty fix to utilize TS-QueryGroups for providing the domain:
function TS-GetGroupDetails
{
param(
[string[]] $Name = "",
[string[]] $ID = "",
[string[]] $Domain ="local"
)
$response = Invoke-RestMethod -Uri ${protocol}://$server/api/$api_ver/sites/$siteID/groups -Headers $headers -Method Get
foreach ($detail in $response.tsResponse.Groups.Group)
{
if ($Name -eq $detail.name -and ($Domain -eq $detail.Domain.Name -or (ts-querygroups | where {$_.Name -eq $Name}).Domain -eq $detail.Domain.Name)){Return $detail.ID}
if ($ID -eq $detail.ID){Return $detail.Name}
}
}
Hi Glen,
Many thanks for your PowerShell scripts for Tableau REST API.
By any chance, you will also be updating the helpfile to reflect on the newer 3.2 API script?
THanks
Nelson
I am trying to run the flow using the API method below
Invoke-RestMethod -Method GET "https://myserver/api/3.17/sites/mysite-id/flows/runs/myflow-id" -H @{"X-Tableau-Auth"= "$token"}
Then I got the message " The remote server returned an error: (404) Not Found."
I am able to connect to the server to get the site id, flow id.
Have anyone got this error message?
Hi guys i hope you can help, im trying to use your publish datasource function and im getting the following error
Exception calling "UploadString" with "3" argument(s): "The remote server returned an error: (500) Internal Server Error
I connect to the server fine using the TS-Signin but then i get failure on publishing the datasource. The datasource file is a .tdsx that i had downloaded directly from our tableau server that im trying to publish back with a different datasource name for testing. Have not modified the file in anyway
I have googled the error and there seems to be other people having the same issue with uploadstring where it used to work before, however im unable to find a solution.
Any help would be much appreciated
Kind regards
Stewart
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.