4 Replies Latest reply on Aug 5, 2009 7:28 AM by ahe

    Add registry info via a custom script??

    Rookie

      I'm trying to create a custom script to add a registry entry to the RunOnce key. The problem I'm having is the amount of quotes I require in order for it to run properly. No matter what combination of quotes I use, whether it be <qt/> or ", I don't get the end result I need, which is an entry in the RunOnce key that looks like this: "C:\Program Files\LANDesk\LDClient\miniscan.exe" "/send= Custom Data - Lock Status = Unknown".

       

       

      Here's the script:

      [MACHINES]
      REMEXEC0=C:\Windows\System32\reg.exe add HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce /v MiniScan /t REG_SZ /d <qt/>C:\Program Files\LANDesk\LDClient\miniscan.exe<qt/> "/send= Custom Data - Lock Status = Unknown", SYNC

        • 1. Re: Add registry info via a custom script??
          ahe Expert

          Hello,

           

          what's happen if you try to run this line manually?

           

          C:\Windows\System32\reg.exe add HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce /v MiniScan /t REG_SZ /d "C:\Program Files\LANDesk\LDClient\miniscan.exe /send= Custom Data - Lock Status = Unknown"

           

          This script creates the entries on my client...

           

          [MACHINES]
          REMEXEC0=C:\Windows\System32\reg.exe add HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce /v MiniScan /t REG_SZ /d "C:\Program Files\LANDesk\LDClient\miniscan.exe /send= Custom Data - Lock Status = Unknown", SYNC
          
          

           

          But what's happen, if you've not a XP machine or the windows directory has a different name. I prefer in this case the start of a batch and use parameters like %windir%...

           

           

           

          Regards

          Axel

          • 2. Re: Add registry info via a custom script??
            Rookie

            The line

             

            C:\Windows\System32\reg.exe add HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce /v MiniScan /t REG_SZ /d "C:\Program Files\LANDesk\LDClient\miniscan.exe /send= Custom Data - Lock Status = Unknown"

            Will run fine normally in Windows and the registry key will be placed. However, the above line will not run properly upon reboot/login. The second set of quotes are missing after miniscan.exe and before /send=. It's the two sets of quotes that are upsetting the custom script.

             

            [MACHINES]
            REMEXEC0=C:\Windows\System32\reg.exe add HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce /v MiniScan /t REG_SZ /d "C:\Program Files\LANDesk\LDClient\miniscan.exe" "/send= Custom Data - Lock Status = Unknown", SYNC

            The custom script doesn't seem to play nicely with those second quotes.

            • 3. Re: Add registry info via a custom script??
              phoffmann SupportEmployee

              Rather than custom script (rarely used these days anyway), it might be easier to just use a batch file (you can combine this with a .REG file) that you can then use with policies etc, to distribute (and you'll get the choice still whether you want to run as local system and all that fun stuff.

               

              Generally, especially with batch files now being so malleable, there's very little reason I find to keep using custom scripts - in this case, it may make your life a lot easier too .

               

              - Paul Hoffmann

              LANDesk EMEA Technical Lead

              1 of 1 people found this helpful
              • 4. Re: Add registry info via a custom script??
                ahe Expert

                Ok,

                 

                so it's better/easier to use a batch... :-)

                 

                Here you can find some additional hints for custom scripts: http://community.landesk.com/support/servlet/JiveServlet/previewBody/2575-102-1-4614/v8Using%20Custom%20Scripts2.pdf

                 

                Here you can find hints about working with Registry keys in a batch: http://community.landesk.com/support/docs/DOC-2417

                 

                Regards

                Axel