none
Run bat file to call reg file in sccm

    Question

  • Folks,

    Push reg file Through sccm to Domain Pc's.

    Run bat file to call Reg file is not working in same folder, and what command need to be used in SCCM package command line???

    Ta

     

     


    With best regards Siddarth Sajjan : Disclaimer: This posting is provided "as is" with no warranties, and confers no rights.
    Thursday, January 26, 2012 9:40 AM

Answers

  • Why use a btach for this?

    Why not just create an empty package and put that command-line directly in the program?

    Using a batch file can introduce path issues that must be handled similar to what Jorgen posted.


    Jason | http://myitforum.com/myitforumwp/community/members/jasonsandys/ | Twitter @JasonSandys
    Thursday, January 26, 2012 1:49 PM

All replies

  • What's not working? How does the content of the batch file look like? Any errors? Please add more details.
    Torsten Meringer | http://www.mssccmfaq.de
    Thursday, January 26, 2012 9:41 AM
  • bat file:

    regedit.exe /s file.reg

    bat file and reg file are located in same folder. Bat file is not calling reg file and want to use these in sccm.


    With best regards Siddarth Sajjan : Disclaimer: This posting is provided "as is" with no warranties, and confers no rights.
    Thursday, January 26, 2012 10:02 AM
  • Hi,

    You need to run the command like this 

    @ECHO OFF
    SETLOCAL

    Set THISDIR = %~dp0

    regedit /s "%THISDIR%file.exe"

    for more info: http://www.myitforum.com/articles/1/view.asp?id=12036

    Regards,
    Jörgen

     


    -- My System Center blog ccmexec.com -- Twitter @ccmexec
    Thursday, January 26, 2012 10:06 AM
  • Why use a btach for this?

    Why not just create an empty package and put that command-line directly in the program?

    Using a batch file can introduce path issues that must be handled similar to what Jorgen posted.


    Jason | http://myitforum.com/myitforumwp/community/members/jasonsandys/ | Twitter @JasonSandys
    Thursday, January 26, 2012 1:49 PM
  • Hi Jason

    I created vb script to call reg file, when i run vb script I am getting popup message to click yes to import reg file. I want to supress this pop in command line. regedit.exe /s is not working. please see my below vb script.

     

    Set oShell = CreateObject("Wscript.Shell") 

    'Your .Reg file and path goes here as in the example below

    sRegFile = "C:\reg\t.Reg" 'This line runs Regedit in silent mode

    oShell.Run "regedit.exe /s " & Chr(34) & sRegFile & Chr(34), 0, True


    With best regards Siddarth Sajjan : Disclaimer: This posting is provided "as is" with no warranties, and confers no rights.
    Saturday, January 28, 2012 9:38 AM
  • This still begs the question, why use a batch file for this? Why not put regedit /s c:\reg\t.reg directly into your program?

    /s will make regedit silent.


    Jason | http://myitforum.com/myitforumwp/community/members/jasonsandys/ | Twitter @JasonSandys
    • Proposed as answer by -Johno- Sunday, January 29, 2012 10:50 PM
    Saturday, January 28, 2012 8:27 PM
  • Thanks Jason

    I will give it a go...

     


    With best regards Siddarth Sajjan : Disclaimer: This posting is provided "as is" with no warranties, and confers no rights.
    • Proposed as answer by Happytogo Tuesday, April 17, 2012 8:53 AM
    Sunday, January 29, 2012 9:42 AM
  • Hi everyone !

    I tried to modify an existing key inside HKLM hive using the command below. And if I do it my self directly on CMD as Admin is actually changing the key but if I use the same command on SCCM 2012 when finilizing my sequence this command is not executed.

    reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercury Interactive\QuickTest Professional\Rainbow" /f /v "LicType" /t REG_DWORD /d "1"

    And also tryed as : regedit /S "%~dp0Rainbow.reg"

    Any ideas why is not working? The SCCM task sequence should be running as Admin by default and the installation is been done as : Install for System.

    This is the final command to execute to have my application ready to go. Please let me know what could cause this behavior.

    Notice that having more packages just for a reg key is not an option on my case because it was working fine on a previous version of the same application and my Virtual Machine is a clean system so no previous entries could be affecting the installation at all.

    Kind Regards.


    • Edited by Joel E.G_ Friday, June 07, 2013 10:59 PM
    Friday, June 07, 2013 10:56 PM
  • Is it a 32 bit or 64 bit OS?

    What does smsts.log say?


    Jason | http://blog.configmgrftw.com

    Friday, June 07, 2013 11:17 PM
  • Hi !

    This is intended for 64 bits only and there's no sign of failure on SMSTS.log  even is been displayed as installed but the key never got the value "1" any where on the registry. Seems to be not executing that line at all.

    I can't drop a reg file on the users start up because this key should be modified on HKLM and they don't have access rights to it so I tried to put modified once the application is installed and patched.

    Any clues ?


    • Edited by Joel E.G_ Sunday, June 09, 2013 6:40 AM
    Sunday, June 09, 2013 6:38 AM
  • Is the application a 32-bit application?

    When is the application itself installed? Is the script run before or after this? Where in the TS are you executing the task: before or after the Setup Windows and ConfigMgr task?

    Are you running the above using a Run Command-line task?

    Are you actually monitoring the smsts.log during TS execution? The smsts.log, by default, will role at 2MB so it's easy for specific lines relating to a task to not exist anymore -- that's why it's important to pause the TS after execution of the task in question and examine the log and (in this case -- the registry; i.e., troubleshoot.


    Jason | http://blog.configmgrftw.com


    Sunday, June 09, 2013 5:40 PM
  • Hi Jason,

    Yes, this is a 32bits app but the patch will turn it into a 64bits. The installation method is "Script Installer Native" and I didn't checked the option to Run as 32bits in 64bits due to the patch. The whole sequence will be executed correctly but at the end the sequence will execute the line is not working with the 2 methods I tried. I will test it again tomorrow to check again the logs with a new and clean Virtual Machine and check the log file.

    Regards.

    Sunday, June 09, 2013 8:14 PM
  • Hi,

    I finally got the key registered. Somehow the patch installer got locked the registry hive until it finishes so I put a ping to local host for about 45sec to let it finish and that did the trick. I have this painful application ready to go. So now I can move forward !!

    Thanks Jason for your advice and kind regards.

    Tuesday, June 11, 2013 12:21 AM