Tableau Automation

email me

Command Line Tool Options and Script Automation

Using scripting languages or manual operations via the Command Prompt, you can activate online, refresh, and deactivate your license keys. For Tableau Desktop, the application itself provides the command line interface. For Tableau Server, the executable is named tabinstallck.exe and can be used prior to configuring Tableau Server.

When performing quiet installations of Tableau Desktop or Tableau Server, use the online activation parameter to avoid having Tableau prompt the user to manually enter the license key for each installation. In addition, you can use the “return” parameter to retrieve a license and deactivate it without having to manually remove it from an individual machine.

Note: To successfully use the licensing parameters, you must run scripts or perform manual operations as an administrator. For me, I used desktop management software to deploy a compiled script, which ran in the system account.

Task Commands
Online activation Desktop (Windows) start /wait tableau.exe -activate <license-key>
Desktop (Mac) ./Applications/Tableau.app/Contents/MacOS/Tableau -activate <license key>
Server start/wait tabinstallck.exe-activate <license-key>
Refreshing license key Desktop (Windows) start /wait tableau.exe -refresh <license-key>
Desktop (Mac) ./Applications/Tableau.app/Contents/MacOS/Tableau -refresh <license key>
Server start /wait tabinstallck.exe -refresh <license-key>
Deactivating license key Desktop (Windows) start /wait tableau.exe -return <license-key>
Desktop (Mac) ./Applications/Tableau.app/Contents/MacOS/Tableau -return <license key>
Server start /wait tabinstallck.exe -return <license-key>

 

For example, a script that could be used to activate Tableau Desktop on a Windows computer would look like the following:

Batch Script

@echo on
Title Deactivate Tableau
cls
Echo Deactivating...
tableau.exe -return FD1Q-6QME-25V9-575F-27FPC
ping -n 4 127.0.0.1>nul
cls
echo Deactivation Complete!
ping -n 4 127.0.0.1>nul
exit /b 0

Dealing with the registration Pop up

AutoIT Script

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#region ---Au3Recorder generated code Start (v3.3.7.0) ---

#region --- Internal functions Au3Recorder Start ---

Func _Au3RecordSetup()
Opt('WinWaitDelay',100)
Opt('WinDetectHiddenText',1)
Opt('MouseCoordMode',0)
EndFunc

Func _WinWaitActivate($title,$text,$timeout=0)
WinWait($title,$text,$timeout)
If Not WinActive($title,$text) Then WinActivate($title,$text)
WinWaitActive($title,$text,$timeout)
EndFunc

_AU3RecordSetup()

RegWrite("HKCU\Software\Tableau\Registration\Data", "company", "REG_SZ", "ABC")
RegWrite("HKCU\Software\Tableau\Registration\Data", "country", "REG_SZ", "FR")
RegWrite("HKCU\Software\Tableau\Registration\Data", "email", "REG_SZ", "ABC@xya.com")
RegWrite("HKCU\Software\Tableau\Registration\Data", "first_name", "REG_SZ", "ABD")
RegWrite("HKCU\Software\Tableau\Registration\Data", "last_name", "REG_SZ", "XYZ")

#endregion --- Internal functions Au3Recorder End ---

Local $Ostype = RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\", "PROCESSOR_ARCHITECTURE")

If $Ostype = "X86" Then
Run('C:\Program Files\Tableau\Tableau Reader 9.3\bin\tabreader.exe')
Else
Run('C:\Program Files (x86)\Tableau\Tableau Reader 9.3\bin\tabreader.exe')
EndIf

_WinWaitActivate("[Class:Qt5QWindowIcon]","",1)
Send("{ENTER}{ENTER}{ENTER}")
Local $PID = ProcessExists("tabreader.exe")
If $PID Then ProcessClose($PID)

 

Yet, another script

#include <MsgBoxConstants.au3>
BlockInput(1)

Run("C:\Program Files\Tableau\Tableau Reader 10.0\bin\tabreader.exe")
Global $i = 0

Sleep(6000)
;Main Timing
WinWait("Activate Tableau Reader", "", 30)

Sleep(1000)
DO
If WinExists("Activate Tableau Reader") Then
WinActivate("Activate Tableau Reader")
Send("ABC")
;Sleep(50)
WinActivate("Activate Tableau Reader")
Send("{TAB}")

WinActivate("Activate Tableau Reader")
Send("Inc")
;Sleep(50)
WinActivate("Activate Tableau Reader")
Send("{TAB}")

WinActivate("Activate Tableau Reader")
Send("Username")
;Sleep(50)
WinActivate("Activate Tableau Reader")
Send("{TAB}")

WinActivate("Activate Tableau Reader")
Send("You@Computer.com")
;Sleep(50)
WinActivate("Activate Tableau Reader")
Send("{TAB}")

WinActivate("Activate Tableau Reader")
Send("12345")
;Sleep(50)
WinActivate("Activate Tableau Reader")
Send("{TAB}")

WinActivate("Activate Tableau Reader")
Send("U")
;Sleep(50)
WinActivate("Activate Tableau Reader")
Send("{TAB}")

WinActivate("Activate Tableau Reader")
Send("F")
;Sleep(50)
WinActivate("Activate Tableau Reader")
Send("{TAB}")
Send("{ENTER}")
ExitLoop
$i = 20
EndIf
$i = $i + 1
;Sleep(1000)
UNTIL $i &gt; 14

BlockInput(0)
Run("taskkill /f /im tabreader.exe", "",@SW_HIDE)
Sleep(1000)

MsgBox($MB_OK, "Tableau 10.0", " Tableau has been activated.")

;@SW_HIDE = Hidden window (or Default keyword)
;@SW_MINIMIZE = Minimized window
;@SW_MAXIMIZE = Maximized window

 

VBScript Method

on error resume next

Set objShell = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")

Const HKEY_LOCAL_MACHINE = &H80000002
Const OverwriteExisting = TRUE
'SETS CURRENT DIRECTORY TO VARIABLE
strCurrentDirectory = objShell.CurrentDirectory
strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set objRegistry=GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\ProfileList"
objRegistry.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubkeys
For Each objSubkey In arrSubkeys
on error resume next
strValueName = "ProfileImagePath"
strSubPath = strKeyPath & "\" & objSubkey
objRegistry.GetExpandedStringValue HKEY_LOCAL_MACHINE,strSubPath,strValueName,strValue
Const POPUP_TITLE = "User To SID Conversion"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set objAccount = objWMIService.Get("Win32_SID.SID='" & objSubkey & "'")
strUser = objAccount.AccountName
'strDomain = objAccount.ReferencedDomainName'returns referenced domain

'DISPLAY PROFILE NAME & SID
objSubkey = trim(objSubkey)'trims whitespace
strUser = trim(strUser)'trims whitespace
'msgbox "objSubkey: " & objSubkey'returns SID
'msgbox strUser'returns username

'LOGIC TO DETERMINE IF REGISTRY ACCOUNT IS TO BE LOADED
if strUser = "SYSTEM" then strUser=""
if strUser = "LOCAL SERVICE" then strUser=""
if strUser = "NETWORK SERVICE" then strUser=""
if strUser = "ADMINISTRATOR" then strUser=""

if strUser <> "" then
on error resume next
Wscript.Sleep 1000

'ADD REG KEYS
objShell.Run "%comspec% /c reg.exe add "&chr(34)&"HKEY_USERS\" & objSubkey & "\Software\Tableau\Registration\Data"&chr(34)&" /t REG_SZ /v ""company"" /d ""ABC Inc"" /f",0,true
objShell.Run "%comspec% /c reg.exe add "&chr(34)&"HKEY_USERS\" & objSubkey & "\Software\Tableau\Registration\Data"&chr(34)&" /t REG_SZ /v ""country"" /d ""US"" /f",0,true
objShell.Run "%comspec% /c reg.exe add "&chr(34)&"HKEY_USERS\" & objSubkey & "\Software\Tableau\Registration\Data"&chr(34)&" /t REG_SZ /v ""email"" /d ""You@email.com"" /f",0,true
objShell.Run "%comspec% /c reg.exe add "&chr(34)&"HKEY_USERS\" & objSubkey & "\Software\Tableau\Registration\Data"&chr(34)&" /t REG_SZ /v ""first_name"" /d ""User"" /f",0,true
objShell.Run "%comspec% /c reg.exe add "&chr(34)&"HKEY_USERS\" & objSubkey & "\Software\Tableau\Registration\Data"&chr(34)&" /t REG_SZ /v ""last_name"" /d ""Inc"" /f",0,true
objShell.Run "%comspec% /c reg.exe add "&chr(34)&"HKEY_USERS\" & objSubkey & "\Software\Tableau\Registration\Data"&chr(34)&" /t REG_SZ /v ""state"" /d ""TX"" /f",0,true

objShell.Run "%comspec% /c reg.exe add "&chr(34)&"HKEY_USERS\" & objSubkey & "\Software\Tableau\Tableau Reader 8.1"&chr(34)&" /t REG_SZ /v ""DefaultsInstalled"" /d ""8100.14.0510.1702"" /f",0,true

objShell.Run "%comspec% /c reg.exe add "&chr(34)&"HKEY_USERS\" & objSubkey & "\Software\Tableau\Tableau Reader 8.1\LicenseCache"&chr(34)&" /t REG_SZ /v ""Desktop"" /d ""ew752794|<license-cache><map key='feature' value='' /><map key='signature' value='' /><map key='maintenance-date' value='12/31/2028 12:00:00 AM' /><map key='expiration-date' value='12/31/2028 12:00:00 AM' /><map key='vendor-string' value='CAP=NOLICUI,NOSERVER,REG:SHORTLOC,WARN:0;DC_CAP=;DC_STD=default;EDITION=Standard;MAP_CAP=;MAP_STD=default;OEMNAME=;OFFLINE=true;TRIALVER=' /></license-cache>"" /f",0,true

end if

Next