6 Replies Latest reply: Mar 30, 2012 7:19 AM by steve49423 RSS

    Provisioning Template "Update Registry"

    tlman12 Rookie

      I'm trying to use the Update registry option in the vonfiguration part of the template but it dosn't give me the option to speicify 64bit keys because instead of changing the key i want it's changing the key of the same path under the wow3264node key. unfortuanatly this has no effect..

       

      i've tried HKLM64 and that didn't work either. 

        • 1. Re: Provisioning Template "Update Registry"
          Specialist

          You can also use the execute action and run regedit /s yourregfile.reg

          • 2. Re: Provisioning Template "Update Registry"
            Ascott860 Specialist

            It kills me that provisioning does not recognize 64-bit registry or system files. What I do is call cscript and run a vbsript to make changes to the 64-bit registry. Hopefully they fix this soon, it is a 64-bit age. As for having to make changes or add to anything in system32, I recently found out you can use the sysnative variable, although I have not tried it.

             

            I have had problems running more then one vbscripts that make changes to 64-bit registry. Actually got a ticket open on this one after this AM. But if you just deploy one vbscript in your template to make changes you should be fine.

            • 3. Re: Provisioning Template "Update Registry"
              Rookie

              I have just come across this issue, extremely frustrating but can be easily managed by other means. I'm currently using AutoIT to write to x64 registry. Does anyone know if this has been rectified in LDMS 9 SP3?

              • 4. Re: Provisioning Template "Update Registry"
                Apprentice

                I use VBScript to do it.  I created a function that checks for the sysnative folder.  If it exists, I can assume that the script is running as a 32bit script on a 64bit system.  It then runs the script from the start, using the wscript.exe from the sysnative folder.  This in essence gives you a 64bit vbscript environment.  Once the script completes, it goes back to the first instance and quit.  Basically, just add this function and then call it first thing in your script.  You can then write your script assuming that you're in a 32bit script on a 32bit system, or you're a 64bit script on a 64bit system.

                 

                 

                'This is a function to force the script to run in 64bit mode.  Make sure you run this function from the start.
                Function Force64Bit
                    'Declare scripting objects
                    Set oShell = CreateObject("WScript.Shell")
                    Set oFSO = CreateObject("Scripting.FileSystemObject")
                   
                    'Declare Environment variables
                    eWinDir = oShell.ExpandEnvironmentStrings("%WINDIR%")
                   
                    'Declare Variables
                    Dim sReturnCode, sArguments
                       
                    'Check to see if the sysnative folder exists.
                    'This folder is invisible when running as 64 bit.
                    If oFSO.FolderExists(eWinDir & "\sysnative") = True Then
                        'Pull in all of the command line arguments.
                        If WScript.Arguments.Count > 0 Then
                            For i = 0 To WScript.Arguments.Count - 1
                                sArguments = sArguments & " " & WScript.Argument.Item(i)                                       
                            Next
                        End If       
                       
                        'Restart script in 64bit mode
                        sReturnCode = oShell.Run(eWinDir & "\sysnative\wscript.exe """ & WScript.ScriptFullName & """ " & sArguments,0,True)
                       
                        'The script should have already ran in 64 bit mode, so just exit.  Return the exit code from the script
                        WScript.quit sReturnCode
                    End If
                   
                    'Returns true if already 64bit
                    Force64Bit = True
                End Function
                • 5. Re: Provisioning Template "Update Registry"
                  Rookie

                  In order to work on non SysWOW hive of registry, you can replace the template action "Update Registry" by an action "Execute file" which executes the reg.exe tool from the Sysnative virtual directory.

                   

                  This will work only on 64 bits OS, as 32 bits OS don't even know about Sysnative directory.

                   

                  Here is the way I work with registry on 64 bits OS :

                  Template action : Execute file

                  Target path and file name : %%windir%%\Sysnative\reg.exe

                  Command-line parameters : add HKLM\SOFTWARE\Company\Product\ /v KeyName /t REG_SZ /d Value /f

                   

                  Using standard reg.exe usage, you can with such a template action make any modification you need on 64 bits registry from a 32 bits process.

                  • 6. Re: Provisioning Template "Update Registry"
                    steve49423 Apprentice

                    Or you could just create a batch file software distribution package that updates the registry (simple reg command) and enable the "run as 64bit application" option

                     

                     

                    Then use a distribute software action in the template.  This is how I get round it - single line batch file and using something in LANDesk that automatically handles 32/64bit file and registry without having to re-engineer anything!