5 Replies Latest reply on Nov 10, 2011 8:03 AM by Catalysttgj

    Custom Data Form requiered at start


      I have a custom data form with information of the employees of my company that asociate his information to a device and I want to keep that data the most updated as possible in case that the employee change his device so I want to make one custom data form to be displayed at the start of Windows or scheduled once a week.

        • 1. Re: Custom Data Form requiered at start
          Catalysttgj Expert

          We went through a lot of research on the best way to pull this off, and the outcome for us was to incorporate some custom code into a logon script to trigger launching the custom forms app. It was done this way to gaurantee a succesful launch of the form but only where the form data was not already populated. The file LDCUSTOM.DAT is pretty much empty when there has been no input.


          In theory you might could use the local scheduler, (provided that you are on 8.8 or higher). You could schedule a launch of the custom form upon log on or upon a scheduled frequency that could be set up for once a week or even once a month i believe. You don't want it to try and launch when no one is logged in though since its a UI. If its launched with no user, it can end up as a process running with no visibility to the user. Then its just a stuck process in memory until a reboot is done, or until the app is killed via task manager. At any rate, you'll want to research setting up a local scheduler customized item and if you can put a requirement of a logged on user on it with a schedule as well, if you decide to take it this direction, but i think there's going to be some annoying limitations that might end up pushing you back to a logon script triggered method. You can get much more complex with a customized code method, but obviously thats a lot more work.


          Hope thats helpful.

          • 2. Re: Custom Data Form requiered at start



            If you could share any more of your methods or what your custom code called to get the forms to run I would love to hear it. I am pretty much in the same boat, I want users to fill out a form and I want it in their face ever time they boot if the form is not filled out.



            • 3. Re: Custom Data Form required at start
              Catalysttgj Expert

              So the approach that we took was to figure out a sort of minimum size to expect for a "completed" form. Now, the only trick to this was that we're in a mixed mode situation with our agent installs. We're currently running 8.7 agents and 9.0 agents, and the big difference for these is that everything is in unicode with 9, so the LDCUSTOM.DAT file is so much with 9 and half the size with 8.7. In our case the minimum completed form file size worked out to be about 1300+ bytes in ANSI or 2600+ in uni.


              So a basic pseudocode for this is:


              1.) Look for LDCUSTOM.DAT in the LANDesk client directory. Exists? YES/NO

              2.) If yes for item 1, check size. Size greater/equal to minimum size required? YES/NO

              3.) if the answer to 1 or 2 is NO, then launch LDCSTM32.EXE


              Now, there's some special things to take into account, but they're probably more than is really needed.

              1.) You may not want the whole world to get this all at once, so you may want to create a marker on a machine to use as a trigger to tell your code that you want it to work, so that you can then build a package or custom definition in landesk and distribute out that trigger. This way to can limit the number of devices that will start getting the form, instead of compelling everyone to get it all at once, which might be a typical issue with using a logon script in the first place.

              We accomplished this by placing a registry value on devices. The logon script code would look for this registry value as the trigger.

              2.) You may want to check to make sure that the form is not already running. This is probably overkill, but just in case the logon script code was accidently launched a couple of times in the same logon session, this would prevent double execution of the form. We accomplished this by using a special extender that is part of winbatch that allows for checking for processes that are already running. You will notice the reference to this in the UDF code below, however it is actually calling a separate UDF for this function (CountAProcess). You could accomplish the same thing with something like pslist, if you wanted to, or you probably have another approach with your script language preference.


              Things worth noting. We only use one custom form. This method would probably not be ideal for more than one form, since it would cause it to make every form come up, one after each other. I don't know much about how one could execute only one particular form in a multiple form presence. Also, in our configuration, we use the form from the server, so that its quicker/simpler to update it. You might place forms directly on devices in your environment. While it should have no impact on this method, I just want to point out that our method of using the form is about as simple as it can get. One form and on the server.

              Also, the LDCUSTOM.DAT file is just a basic text file. If you are clever enough you could actually script out something that actually reads its contents and then you do much more complex decision making if you wanted. The LDCUSTOM.INI file will contain the name of the form(s) and their last edit date/time encoded in a number. You'll probably find more on that number if you look around in the forum.


              Good luck!


              Below is the Winbatch UDF that is used to do this work in our logon script, but since its winbatch, you might not find it that useful other than a good reference for steps to take to do what you need to do in your script language preference:


              #DEFINEFUNCTION LNDskCustForm (cpname)
              pth = "C:\Progra~1\LANDesk\LDclient"
              app = "LDCSTM32.EXE"
              exe = "%pth%\%app%"
              ini = "%pth%\LDCUSTOM.INI"
              dat = "%pth%\LDCUSTOM.DAT"
              dst = "\\servernamehere\LOGS\LANDesk\LDCustom\%cpname%.dat"
              sze = 0
              ;write file server path to ini
              IniWritePvt("PARAMS", "i", "\\LDMS-CORE\ldlogon\*.frm", ini)
              ;get the actual size of the file in bytes.
              if fileexist(dat) then sze = filesizeex(dat)
              ;if the current file is empty, then attempt to get a copy from a server.
              ;if sze < LNDskCustSize(1296, sze) && fileexist(dst) then filecopy(dst, dat, @false)
              ;upload file if it doesn't exist at destination.
              if sze > LNDskCustSize(1296, sze) && !fileexist(dst) then filecopy(dat, dst, @false)
              ;get the actual size of the file in bytes again.
              if fileexist(dat) then sze = filesizeex(dat)
              ;if the file is still empty then its time to work on getting it populated.
              if sze < LNDskCustSize(1296, sze) then
              ;check to see that the computer is marked to activate the forms app.
              regpth = "SOFTWARE\ESD\INFO[CustForm]"
              if regexistvalue(@REGMACHINE, regpth) then
              val = regqueryvalue(@REGMACHINE, regpth)
              opc = itemextract(1, val, ":")
              if opc == "1" then
              ;check to see that the forms app is not already running.
              if CountaProcess(app) == 0 then
              ;launch and remember the number of times that the app has been launched by this code.
              run(exe, "/FE")
              cnt = itemextract(2, val, ":")
              if !isnumber(cnt) then cnt = 0
              cnt = cnt + 1
              val = "%opc%:%cnt%"
              regsetvalue(@REGMACHINE, regpth, val)
              end if
              WinActivate("Inventory Data Collection")
              end if
              end if
              end if
              1 of 1 people found this helpful
              • 4. Re: Custom Data Form required at start

                Wow!!! Thanks so much for that information dump, I will be going through it and making use of it!!!



                • 5. Re: Custom Data Form required at start
                  Catalysttgj Expert

                  No problem. If you wouldn't mind taking a look at this other thread, and, if appropriate, share what you think about it: http://community.landesk.com/support/message/69827#69827


                  Would really appreciate input on it.