6 Replies Latest reply on Mar 14, 2009 5:11 PM by MarXtar

    vbscript distribution issue


      I have a vbscript that I wrote that installs a printer and want to push it onto several PC's using version LD8.7 sp6.


      This is the first time I've tried to push a vbs file by itself.  The script itself works fine but when I use Windows Script Host option to push this script it won't run.  I get no errors and the file does get pushed to the pc, it just doesn't seem to run.   Do I need to add something to the "command line" option to kick start this thing.



        • 1. Re: vbscript distribution issue
          Jason SupportEmployee

          It is most likely a permissions issue. When ever you push software with LDMS it use the localsystem account on the client to do the install. My 1st guess is that your script will not run as localsystem you can test that by looking at the following link.



          • 2. Re: vbscript distribution issue
            zman Master

            Posting the script and log files will help us, but I think that the printer install uses a lot of HKCU reg keys which are not accessible when the job is elevated as the local system account. You could try to run job with user credentials.


            BTW, love this Jason:



            • 3. Re: vbscript distribution issue

              Before I post my script let me just say that I'm by no means any expert in script writing.  Matter of fact I was "volunteered" to try to do this because I took a few semesters of C++ and Java programing in college 10yrs ago so I have the most experience.   Like I mention before this script does work just fine by itself and the issue is probably because LANDesk runs it has the localsystem but I'm not sure how to change rights within the script, if possible.


              BTW I run this for XP only.




              strComputer = "."
              devicename = "HP LaserJet 4000 Series PCL"


              Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
              Set objNewPort = objWMIService.Get("Win32_TCPIPPrinterPort").SpawnInstance_


              objNewPort.Name = "IP_xxx.xxx.xxx.xxx"
              objNewPort.Protocol = 1
              objNewPort.HostAddress = "xxx.xxx.xxx.xxx"
              objNewPort.PortNumber = "xxxx"
              objNewPort.SNMPEnabled = False


              Set objDriver = objWMIService.Get("Win32_PrinterDriver")
              objDriver.Name = devicename
              objDriver.SupportedPlatform = "Windows NT x86"
              objDriver.Version = "3"
              objDriver.DriverPath = "%windir%\inf"
              objDriver.Infname = "%windir%\inf\ntprint.inf"
              intResult = objDriver.AddPrinterDriver(objDriver)


              Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_


              objPrinter.DriverName = devicename
              objPrinter.PortName   = "IP_xxx.xxx.xxx.xxx"
              objPrinter.DeviceID   = "somename"
              objPrinter.Location   = "somename"
              objPrinter.Network = True
              objPrinter.Shared = False     


              'Wscript.Echo "Done."

              • 4. Re: vbscript distribution issue
                zman Master

                If you have a newer version of LANDesk I think 8.8 than on distribution packages screen | accounts | Current User Account.


                Earlier versions use startasuser http://community.landesk.com/support/docs/DOC-1575

                • 5. Re: vbscript distribution issue
                  cknott SupportEmployee

                  The easiest way to check to see if your script will function as LocalSystem is to open a cmd window that is running as local system instead of the local user.


                  To do this open a cmd window and put it:


                  at XX:XX +1 /interactive cmd


                  The XX:XX is the current time in military format, plus 1 or 2 minutes.  This is creating a local scheduled task to run at the time you set.


                  When the cmd window opens it will be running as local system, and you can try and run your vb script from there.


                  Hope that helps!

                  • 6. Re: vbscript distribution issue
                    MarXtar ITSMMVPGroup

                    Is there a reason why you can't use AD functionality to assign printers to users?  LANDesk really isn't designed to do printers so while it's possible, AD is designed to do it so use it if you can.


                    Mark Star - MarXtar LANDesk Enhancements

                    Home of Power State Notifier & Wake-On-WAN for LANDesk