8 Replies Latest reply on Aug 24, 2015 10:07 AM by Michel Roberge

    tabcmd from remote server

    Derek Fernandes

      Hi all,

       

      Background: We create .NET web applications and embed Tableau visuals on some of the web pages. We wanted to automate some of the Tableau user management so when writing new .NET applications, we could add users/groups on the fly.

       

      Environment: We have a .NET web app server (dev and production) and a separate Tableau Server (v 7.0.13).

       

      I installed tabcmd on my local PC to see if I could run commands via command line -- everything works normally.  I've also created a .NET C# class library to wrap the tabcmd commands and this DLL will be added to our existing .NET applications to execute tabcmd commands.  This is all working from my local machine. It also logs the tabcmd commands in the log file in C:\Users\<username>\AppData\Roaming\Tableau\tabcmd.log on my local machine.

       

      I installed tabcmd on our dev app server and I can run tabcmd commands via the command line here as well. I published my .NET web application however, I am getting an error when running any of the tabcmd commands (see below) from my .NET application. It also does not log any of the commands to the log file location. 

       

      Errno::EEXIST: File exists - C:\Windows\system32\config\systemprofile

               mkdir at org/jruby/RubyDir.java:444

            fu_mkdir at file:/C:/tabcmd/Command Line Utility/jruby-stdlib-1.6.2.jar!/META-INF/jruby.home/lib/ruby/1.8/fileutils.rb:243

             mkdir_p at file:/C:/tabcmd/Command Line Utility/jruby-stdlib-1.6.2.jar!/META-INF/jruby.home/lib/ruby/1.8/fileutils.rb:217

        reverse_each at org/jruby/RubyArray.java:1682

             mkdir_p at file:/C:/tabcmd/Command Line Utility/jruby-stdlib-1.6.2.jar!/META-INF/jruby.home/lib/ruby/1.8/fileutils.rb:215

                each at org/jruby/RubyArray.java:1602

             mkdir_p at file:/C:/tabcmd/Command Line Utility/jruby-stdlib-1.6.2.jar!/META-INF/jruby.home/lib/ruby/1.8/fileutils.rb:201

             mkdir_p at file:/C:/tabcmd/Command Line Utility/jruby-stdlib-1.6.2.jar!/META-INF/jruby.home/lib/ruby/1.8/fileutils.rb:1539

              (root) at file:/C:/tabcmd/Command Line Utility/tabcmd.jar!/tabcmd/lib/logging.rb:87

             require at org/jruby/RubyKernel.java:1038

             require at file:/C:/tabcmd/Command Line Utility/tabcmd.jar!/tabcmd/lib/logging.rb:29

              (root) at file:C:/tabcmd/Command Line Utility/tabcmd.jar!/tabcmd/lib/tabcmd.rb:19

             require at org/jruby/RubyKernel.java:1038

             require at file:C:/tabcmd/Command Line Utility/tabcmd.jar!/tabcmd/lib/tabcmd.rb:29

              (root) at file:/C:/tabcmd/Command Line Utility/tabcmd.jar!/tabcmd/bin/tabcmd.rb:34

                load at org/jruby/RubyKernel.java:1063

              (root) at file:/C:/tabcmd/Command Line Utility/tabcmd.jar!/tabcmd/bin/tabcmd.rb:1

             require at org/jruby/RubyKernel.java:1038

             require at file:/C:/tabcmd/Command Line Utility/tabcmd.jar!/META-INF/main.rb:29

       

      It appears to be installing Ruby on Rails packages (or something similar). I've uninstalled and re-installed tabcmd on the server, checked directory permissions and confirmed that running tabcmd via command line works on the server (and logs the command to the log file).

       

      Any ideas on what I am missing or what this error is?

       

      Thanks,
      Derek

       

       


        • 1. Re: tabcmd from remote server
          chuck sakoda

          I ran into a similar issue when trying to run tabcmd from IIS.

           

          I run our IIS app pools under a custom domain user, and had to set 'Load User Profile' to 'True' in order for the temp files to be written to the proper location.  Without setting this the following line in logging.rb causes issues:

           

          log_dir =   Pathname.new(File.join(ENV['APPDATA'], 'Tableau'))

           

          ENV['APPDATA'] will default to the systemprofile directory when not otherwise configured in the App Pool settings.

           

          Hope this helps.

          • 2. Re: tabcmd from remote server
            chuck sakoda

            As an update, we ended up with a hacky workaround to this issue, creating a wrapping script that properly sets the APPDATA variable for the execution context:

             

            @echo off

            set APPDATA=C:\Users\{application pool user}\AppData\Roaming

            "C:\Program Files (x86)\Tableau\Tableau Server\7.0\extras\Command Line Utility\tabcmd.exe" %*

            • 3. Re: tabcmd from remote server
              Russell Christopher

              Another common issue (not Derek's based on what he's describing) is the fact that we assume TabCmd will be run interactively - in other words, that there will be a user profile available to TabCmd. When TabCmd is automated from via another service (like code running in an app under IIS), the profile won't be there and TabCmd will fail.

              • 4. Re: tabcmd from remote server
                Michel Roberge

                Hi,

                 

                I have the same situation, and unless I add the identity pool user to the local Admin group, it will not work.

                 

                I am trying to find out a way to get this to work without making the user an admin - because this can compromise the whole system.

                 

                Any alternatives?

                • 5. Re: tabcmd from remote server
                  eugen.frunza

                  I am also interested in having tabcmd run under a less privileged account than admin.

                  Same question mentioned by Michel Roberge above.

                  • 6. Re: tabcmd from remote server
                    Michel Roberge

                    Hi Eugen,

                     

                    I finally got a working solution.

                     

                    In IIS, use an actual user for the application pool (not Network Service or ApplicationPoolIdentity) as identity, and set the "Load User Profile" to true. I added the user to the IIS Users group.

                     

                    This has worked for me.

                     

                    Good luck!

                    1 of 1 people found this helpful
                    • 7. Re: tabcmd from remote server
                      eugen.frunza

                      Thank you! I will give it a try.

                      • 8. Re: tabcmd from remote server
                        Michel Roberge

                        Hi all,

                         

                        I am "reviving" this thread as it has been more than a year since anyone mentioned anything on this, and I just lately stumbled upon a more complete answer.

                         

                        This can now be "fixed" by doing the following:

                         

                        1. Open %WINDIR%\System32\inetsrv\config\applicationHost.config and look for <applicationPoolDefaults>. Under <processModel>, change setProfileEnvironment="false"to setProfileEnvironment="true".
                          • If it looks like this: <processModel identityType="ApplicationPoolIdentity" />, change it to this: <processModel identityType="ApplicationPoolIdentity" loadUserProfile="true" setProfileEnvironment="true" />
                        2. Add App. Pool identity user to the "IIS_IUSRS" group (or whatever the group name is on the OS for IIS application pool users).
                          • Grant it read access on the Command Line Utility folder (c:\Program Files\Tableau\Command Line Utility\8.2\ for example)
                        3. Restart IIS

                         

                        For me this worked, as adding the user to the IIS_IUSR group alone did not work properly.