3 Replies Latest reply on May 13, 2010 3:12 AM by phoffmann

    batch file distribution - incorrect install under localsystem account

    Rookie

      Good afternoon all,

       

      I have a query regarding creating a batch file distribution package in LDMS9. I'm trying to devise a method to replace a terminalemulator in use on our domain -

      it's called "Viaduct 2000"; the latest version I'm trying to replace it with is "Viaduct FX" (http://www.viasystemsinc.com/external/Viaduct.htm)

       

      I've created a batch file (copied at the bottom of this post) that completes sucessfully when run locally on a test client. During the client setup (Viaduct FX uses installshield - I've created an .iss response file to automate the dialog responses) the existing terminal connections set up on each client are copied and shortcuts to the new application automatically generated. It is this part of the script that fails to run correctly when run as a distribution package. I have noticed however that if I create a package that uses the currently logged on user credentials (at the time of the test this was an account with admin rights to the local machine) as opposed to the localsystem account this succeeds. I am unable to use this solution on all target devices however, as the majority will be using a local, non-admin, user account.

       

      I'm assuming that the issue lies with the softwares (viaduct) inability to install correctly under the localsystem account. With the error checking I have in the script, I do not receive any error codes/failure reports (that's not to say it's foolproof, I'm very much a novice at batch file creation!)

       

      I had the idea of using 'runas' to install the application with an admin account (whilst the distribution package is set to run under localsystem account) but was unsure if this was a suitable method (if indeed useful, as I can't supply a password in the command line)

       

      Hopefully my post makes sense. If anyone has any suggestions as to a solution/workaround it would be  very much appreciated!

       

      Many thanks

       

      David

       

      ===============================contents of batch file================================

      @ECHO ON
      ::Viaduct Upgrade Batch File
      ::Kill any Viaduct process still running
      taskkill /im viaduct.exe /f
      ::Run Viaduct Setup from LANDesk sdmcache (silent install)
      "c:\program files\LANDesk\LDClient\sdmcache\sw\viaduct_fx\setup.exe" -s -f1"c:\Program Files\LANDesk\LDClient\sdmcache\sw\Viaduct_FX\setup.iss" -f2"c:\Program Files\LANDesk\LDClient\sdmcache\sw\Viaduct_FX\setup.log"
      IF NOT "%ERRORLEVEL%"=="0" EXIT /B %ERRORLEVEL%
      ::Delete any shortcuts to viaduct 2000 from default desktop
      del /q "c:\documents and settings\default\desktop\viaduct*.lnk"
      IF NOT "%ERRORLEVEL%"=="0" EXIT /B %ERRORLEVEL%
      ::Delete any shortcuts to viaduct 2000 from all users desktop
      del /q "c:\documents and settings\all users\desktop\viaduct*.lnk"
      IF NOT "%ERRORLEVEL%"=="0" EXIT /B %ERRORLEVEL%
      ::Copy new Viaduct -fx- shorcuts to desktop
      xcopy "%allusersprofile%\Start Menu\Programs\Viaduct -fx-\*.lnk" "%allusersprofile%\desktop\"
      IF NOT "%ERRORLEVEL%"=="0" EXIT /B %ERRORLEVEL%
      ::Clean up any unneeded shortcuts created by previous command
      del /q "c:\documents and settings\all users\desktop\viaduct -fx- Help.lnk"
      IF NOT "%ERRORLEVEL%"=="0" EXIT /B %ERRORLEVEL%
      del /q "c:\documents and settings\all users\desktop\viaduct -fx- Readme.lnk"
      IF NOT "%ERRORLEVEL%"=="0" EXIT /B %ERRORLEVEL%
      del /q "c:\documents and settings\all users\desktop\viaduct -fx-.lnk"
      IF NOT "%ERRORLEVEL%"=="0" EXIT /B %ERRORLEVEL%
      ::remove viaduct 2000 start menu group and installation folder
      echo rd /s /q "c:\documents and settings\all users\start menu\programs\viaduct 2000"
      :: IF NOT "%ERRORLEVEL%"=="0" EXIT /B %ERRORLEVEL%
      echo rd /s /q c:\viadct32
      :end

        • 1. Re: batch file distribution - incorrect install under localsystem account
          Apprentice

          It sounds like you got it all working except for the copying over the shortcuts correctly.

          Have you tried the full path name instead of the "%allusersprofile%"?

           

          ::Copy new Viaduct -fx- shorcuts to desktop
          xcopy "C:\Documents and Settings\All Users\Start Menu\Programs\Viaduct -fx-\*.lnk" "C:\Documents and Settings\All Users\desktop\"

           

          Here is a little batch file I use to help with the LocalSystem account issues,

          --------------------

          @echo off

           

          :start
          :: clear screen and set color
          cls
          title Test Local LD acct
          color 2F

           

          c:
          cd\
          cd C:\program files\LANDesk\LDClient\
          localsch.exe /exe=cmd.exe

           

          :end
          exit

          -------------

          Save and run this batch file, can take up to 30-50 seconds to open a dos prompt with Local System account rights.  CD to your install directory, run your install.  During testing I put pauses in the batch files to help with troubleshooting.  Have to make sure to remove the pauses before you package them into production.

          • 2. Re: batch file distribution - incorrect install under localsystem account
            Rookie

            Thanks for your reply, the Batch file for running a cmd prompt as  localsystem has been very useful in troubleshooting the problem. It  looks like the application I'm trying to deploy fails to actually  generate the shortcuts when run under this account.I have however found a  work around with the aid of psexec - I can run the deployment under current user credentials and use psexec to launch the installer with an administrative account. Not the cleanest of solutions but it's only likely to have to be deployed once on our domain so I can accept it.

             

            Again, thanks for the advice it is much appreciated!

            • 3. Re: batch file distribution - incorrect install under localsystem account
              phoffmann SupportEmployee

              This is something that you should keepin in mind in general - a few apps "don't like" being installed as "local system" - the first time I ran into a wall with that was some AutoCAD system.

               

              Regrettably, Microsoft is still keeping mum about what the differences between "actual local admin" and "local system" access are (since by 'advertising' there shouldn't be any) - one of those lesser known stumbling blocks that can be quite a spanner in the works .

               

              It's not many apps, but they do exist by and large .

               

              Glad to hear this was resolved - thanks to FX for the accurate information he provided.

               

              Another alternative to get a "local system" account is documented here (end result being the same really):

              - http://community.landesk.com/support/docs/DOC-1645

               

              - Paul Hoffmann

              LANDesk EMEA Technical Lead