3 Replies Latest reply on Feb 3, 2017 9:58 AM by MarXtar

    Pushing a BAT file down as a SW Package

    GJHorn Specialist

      Trying to push a BAT file down to set wallpaper for current user does not work. I receive the following error:

       

      Wed, 01 Feb 2017 13:02:03 ******* sdclient starting to process task *******

      Wed, 01 Feb 2017 13:02:03 Task id to process: 4862

      Wed, 01 Feb 2017 13:02:03 Command line: /policyfile="C:\ProgramData\LANDesk\Policies\CP.4862.RunNow._FRNzT8bmDvTv11JQZkbL56ADFbE=.xml"

      Wed, 01 Feb 2017 13:02:03 The nostatus flag has NOT been set.

      Wed, 01 Feb 2017 13:02:03 Core name 'coreserver' obtained from active task list

      Wed, 01 Feb 2017 13:02:03 Sending task status, cmd line -coreandip=coreserver -taskid=4862 -retcode=229392442 "-ldap=CN=john doe,OU=Users,OU=city,OU=Sites,OU=COMP,OU=Americas,DC=xxx,DC=xxx" -pkgid=2224

      Wed, 01 Feb 2017 13:02:03 File (\\coreserver\packages\BAT\Background\US_Background\ChangeDefaultWallaper2017.bat) is not in cache

      Wed, 01 Feb 2017 13:02:03 The nostatus flag has NOT been set.

      Wed, 01 Feb 2017 13:02:03 Core name 'coreserver' obtained from active task list

      Wed, 01 Feb 2017 13:02:03 Sending task status, cmd line -coreandip=coreserver -taskid=4862 -retcode=229392444 "-ldap=CN=john doe,OU=Users,OU=city,OU=Sites,OU=COMP,OU=Americas,DC=xxx,DC=xxx" -pkgid=2224

      Wed, 01 Feb 2017 13:02:04 About to call DownloadFiles (2 files) with these settings:

      Wed, 01 Feb 2017 13:02:04 m_allowedBandwidthWAN: 50

      Wed, 01 Feb 2017 13:02:04 m_allowedBandwidthLAN: 75

      Wed, 01 Feb 2017 13:02:04 m_discardPeriodSeconds: 604800

      Wed, 01 Feb 2017 13:02:04 m_preserveDirectoryStructure: 1

      Wed, 01 Feb 2017 13:02:04 m_bUseWanBWForPush: 0

      Wed, 01 Feb 2017 13:02:04 m_bSynchronize: 0

      Wed, 01 Feb 2017 13:02:04 Allowed download methods(m_downloadControl):

      Wed, 01 Feb 2017 13:02:04 MultiCast

      Wed, 01 Feb 2017 13:02:04 PeerOneSource

      Wed, 01 Feb 2017 13:02:04 Peer

      Wed, 01 Feb 2017 13:02:04 Source

      Wed, 01 Feb 2017 13:02:04 m_preferredServerControl: AttemptPreferredServer

      Wed, 01 Feb 2017 13:02:04 Allowed multicast rep download methods(m_downloadControl):

      Wed, 01 Feb 2017 13:02:04 Multicast Rep delay in seconds: 60

      Wed, 01 Feb 2017 13:02:04 Multicast job guid: {DB500000-0000-0000-0000-000000004862}

      Wed, 01 Feb 2017 13:02:10 Multicast rep state changed 1 (0 not rep, 1 is rep)

      Wed, 01 Feb 2017 13:02:10 ListenForMulticast() become new Mcast rep now and restart multicast file at index = 0

      Wed, 01 Feb 2017 13:03:07 The nostatus flag has NOT been set.

      Wed, 01 Feb 2017 13:03:07 Core name 'coreserver' obtained from active task list

      Wed, 01 Feb 2017 13:03:07 Sending task status, cmd line -coreandip=coreserver -taskid=4862 -retcode=229392444 "-message=100%" -pkgid=2224

      Wed, 01 Feb 2017 13:03:08 The nostatus flag has NOT been set.

      Wed, 01 Feb 2017 13:03:08 Core name 'coreserver' obtained from active task list

      Wed, 01 Feb 2017 13:03:08 Sending task status, cmd line -coreandip=coreserver -taskid=4862 -retcode=229392258 "-ldap=CN=john doe,OU=Users,OU=city,OU=Sites,OU=COMP,OU=Americas,DC=xxx,DC=xxx" -pkgid=2224

      Wed, 01 Feb 2017 13:03:08 ExpandEnvironmentVariables Result:

      Wed, 01 Feb 2017 13:03:08 Batch file Client Thread

      Wed, 01 Feb 2017 13:03:08 PackagePath: [\\coreserver\packages\BAT\Background\US_Background\ChangeDefaultWallaper2017.bat]

      Wed, 01 Feb 2017 13:05:20

      Wed, 01 Feb 2017 13:05:20 Bat file output :  C:\Program Files (x86)\LANDesk\LDClient\sdmcache\packages\BAT\Background\US_Background>call "ChangeDefaultWallaper2017.bat"  

      Wed, 01 Feb 2017 13:05:20 Installation result 8DAC4002

      Wed, 01 Feb 2017 13:05:20 RunPackageInstall: stop on returncode=8dac4002 of package=2017 Wallpaper Setting

      Wed, 01 Feb 2017 13:05:20 processing of package is complete, result -1918091262 (0x8dac4002 - code 16386)

       

       

      The BAT file does this:

      @echo off

      call :quiet>nul 2>&1

      goto :EOF

      :quiet

      :: Configure Wallpaper (command prompt method works only with bmp files)

      REG ADD "HKEY_CURRENT_USER\Control Panel\Desktop" /V Wallpaper /T REG_SZ /F /D "C:\WINDOWS\Wallpaper1.bmp"

      REG ADD "HKCU\Control Panel\Desktop" /V WallpaperStyle /T REG_SZ /F /D 2

      :: REG ADD "HKCU\Control Panel\Desktop" /V TileWallpaper /T REG_SZ /F /D 1

      copy "%~dp0wallpaper1.bmp" C:\Windows\wallpaper1.bmp

      exit 0

       

      If I run the BAT locally, it works fine. If I configure the distribution package so it runs as "Current user's account" or as "Run as a specified user" - it still does not work. When I run the package, the user is logged into the computer and active. The computer is not sleeping.

       

      Does anyone have any clues? Thanks for any help.

      Running LDMS 9.6 SP3

        • 1. Re: Pushing a BAT file down as a SW Package
          phoffmann SupportEmployee

          So a few things -- all this is done on a 9.6 SP3 Core + Client (Win 7 x64).

           

          Step 1 - I've used your batch (note - my user *is* a local admin in this case0, and looked at "what works" on a Win 7 client.

          • Creation of - "HKEY_CURRENT_USER\Control Panel\Desktop\Wallpaper" -- works (including the value of "Wallpaper1.bmp"
          • Creation of - "HKEY_CURRENT_USER\Control Panel\Desktop\WallpaperStyle" -- works (including the value of "2"

           

          ... the copy didn't work in that regard that I didn't have a "%~dp0wallpaper1.bmp" -- I just cheated & dumped a "Wallpaper1.bmp"  into C:\Windows\

           

          ... my batch legitimately complained about the last bit failing (no BMP for it to copy) but the other registry operations worked.

           

          HOWEVER ...

          ... my background wallpaper has not changed right away.

          ... I had to log out, then log back in, THEN Windows would load the correct wall paper for me.

           

          Step 2 - I repeated the above steps with a non-admin user ... so, re-scheduled the policy & checked what the registry had to say for itself. Again, everything worked just fine.

           

          As an aside - useful stuff potentially when troubleshooting is THIS article -- How to enable Xtrace Diagnostic Logging -- not so much needed in this case, as I just checked what actually worked for me (in short - everything), but may be useful to you.

           

          ... so you may want to see whether the registry changes happen & eyeball what doesn't work. Enabling debug logging MAY give you a better idea as to what's going on.

           

          But -- the file copy that wouldn't work for me aside -- your batch file works fine. At least on Win 7 x64.

           

          Note -- I enabled the option to run the batch as 64-bit on 64-bit systems.

          • 2. Re: Pushing a BAT file down as a SW Package
            phoffmann SupportEmployee

            As an additional aside - the "short" log to look at for BAT stuff in particular, tends to be -- "C:\ProgramData\LANDesk\Log\sdistbat.log"

             

            The SDCLIENT_TASK###.LOG under "C:\Program Files (x86)\LANDesk\LDClient\Data" tends to have a lot of stuff around downloading & so on (general task stuff) -- if you're JUST interested in the execution of a batch file, the SDISTBAT.LOG is less chatty and more on point .

            • 3. Re: Pushing a BAT file down as a SW Package
              MarXtar ITSMMVPGroup

              Possibly a silly question but - where is the BMP file?

               

              I might be missing it but I don't see anything in that log talking about copying the BMP down to the client, so did you add it as an additional file in the package?

               

              Code 16386 generally means it can't find something.

               

              %~dp0 is expanding the drive and path for the batch file. So, if the BMP is on the server, then the batch is going to be trying to find it in the path it has been downloaded to on the client. If the BMP is not in the same place, then it won't find it.

               

              Mark McGinn

              MarXtar Ltd/MarXtar Corporation

              http://ivantione.marxtar.com

              Ivanti One Development Partner

               

              Try MarXtar State Management for Ivanti to Better Understand and Manage your Assets