11 Replies Latest reply on Jul 5, 2011 12:45 AM by Jon_UK

    Batch file not running???

    Rookie

      I have this batch file:

       

      @echo off
      rundll32 printui.dll PrintUIEntry /ga /in /n\\cms-dist\CMS-Rm106OfficeColorHP4600 /q
      rundll32 printui.dll PrintUIEntry /y /n\\cms-dist\CMS-Rm106OfficeColorHP4600
      start /wait net stop spooler
      start /wait net start spooler

      When i use policy or push, doesn't seem to run.....however, when i click on it from within the client packages folder, runs perfectly??

       

      Anyone have any ideas why it's not running from within LanDesk V9

        • 1. Re: Batch file not running???
          Specialist

          Which OS are you trying to deploy it to?  XP? W7 x86 or x64? Did it deploy the file but doesn't run?

          • 2. Re: Batch file not running???
            Specialist

            If you are using Windows 7 or Vista, you can join us here:

             

            http://community.landesk.com/support/thread/13253?tstart=15

             

            Best Regards

            Troga

            • 3. Re: Batch file not running???
              Rookie

              It deploys the file.....and seems to run it......if I take the second line out (setting the default) it works.....yet, when i run it from the deployed folder....works perfectly. Just don't get it????

              • 4. Re: Batch file not running???
                Specialist

                Look like your bat file is trying to run  file off a network folder \\cms-dist\CMS-Rm106OfficeColorHP4600.  Which might explain why it works when you execute it manually since you are logged into the machine and can authenticate to the share.  Try to deploy the file as additional file along with your package.

                • 5. Re: Batch file not running???
                  mrspike SSMMVPGroup

                  unless the computers have access to the share (as local system) it cannot connect to the UNC.

                   

                  As mentioned, try adding to additional files, use http: or add your computer accounts to the share

                  • 6. Re: Batch file not running???
                    Rookie

                    That is not a network shared file.....it's a print que.....it's just the name of the printer.....

                     

                    Keep in mind, even if i run the batch file locally, as a student, it works fine. Only not works when landesk policy is in place....

                    • 7. Re: Batch file not running???
                      MarXtar ITSMMVPGroup

                      Are you trying to use this to connect the computer to that printer? If so, then this is something that would normally run under a user context rather than local system. Have you set this up as a batch distribution package and chosen to use the currently logged in user under the accounts section?

                      • 8. Re: Batch file not running???
                        Cedric GRENON Apprentice

                        Hi,

                         

                        I have the same way, but I'm doing to do another way : I want to deploy all drivers of printers we have to the computer.

                         

                        Reason : We're going to powerusers and not administrators. And it's not possible to install devices drivers with power users's rights without apply a GPO to active this and we don't want this GPO on our business.

                         

                        So I use a script to auto install all drivers of printers we have.

                         

                        It looks like :

                         

                        rundll32 printui.dll,PrintUIEntry /ia /f """ & Chemin & Inf & """ /m """ & Nom1 & """",0,True

                         

                        With a read a file line by line.

                         

                        Locally it's working perfectly, but with task in LANDesk (push or policy) it fail.

                         

                        I have too do a "net use" command to share the drivers folder and it's same. And i must use "localsystem" and not "current user" because curent user are power users right.

                         

                        Someone have a idea ?

                        • 9. Re: Batch file not running???
                          Rookie

                          Not sure if this helps but I had a similar problem installing a direct IP based printer using a batch file with prnport.vbs and printui commands. The batch file would run fine manually running as a domain user with local admin rights. When deploying the same batch file via LANDesk the IP port would be created but the printui command to install the drivers and printer would not occur and the scheduled task would never complete. After going through the 'Understanding Batch File Distribution Packages' LANDesk document I tested running the batch file using the local system account. This flagged up the issue - the local system account didn't have permissions to the network share which held the drivers. The solution (assuming you are in a domain environment) is to give the 'Domain Computers' group Read share permissions (unless this is already catered for through other permissions) and Read and Execute NTFS permissions to the share.

                          • 10. Re: Batch file not running???
                            ProServices

                            Hi,

                            You might find some useful information in this doc http://community.landesk.com/support/docs/DOC-2320

                            I know.. it looks a little old.. but the information is still valid and it has some good troubleshooting tips.

                            Regards

                            Ian

                            • 11. Re: Batch file not running???
                              Apprentice

                              I remember having similar problems back in the day with batch files and the account under which it ran.  The quick fix was to create a 'null session share' which used to be standard practice believe it or not in versions 6 or 7 something like that, having a null session share at least rules out any permissions to the source files as your problem.  If it was a problem relating to rights to execute the batch file I either packaged it up as an exe using package builder or I wrote a custom script that basicly had a REMCOPY line to transfer the batch file from the core to the pc and then a second line to copy the hidedos.exe tool so it could run without the user seeing the dos shell run & then a REMEXEC to trigger the batch file locally, similar to below.  You never said if you were running a custom script with your printer script or a script to call, copy and execute the batch file seperatley.  Anyway this worked for me back then, hope it's of some use.

                               

                              [MACHINES]
                              REMCOPY0=%DTMDIR%\ldlogon\batchfile.bat, c:\batchfile.bat, TOREMOTE
                              REMCOPY1=%DTMDIR%\ldlogon\HideDos.exe, c:\HideDos.exe, TOREMOTE
                              REMEXEC0=c:\HideDos.exe Cmd /c c:\batchfile.bat