/build/static/layout/Breadcrumb_cap_w.png

Can Kace run req query scripts?

The script below is just an example of a req query script. If I try running the script from Kace, the script will always goto :two. If I run the script from the machine itself, then the script will goto  :one.

@echo off
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Symantec"
if %ERRORLEVEL% EQU 0 goto One
if %ERRORLEVEL% EQU 1 goto Two


:One
CLS
echo yes
pause
exit

:Two
CLS
ECHO No
pause
Exit


I have tried using running the script as local system, Credentials, and local user. Also tried using HKLM, HKLM64 to see if it will help, but still not having any luck.

KACE Agent = 6.4, do we know if they Req Query bugs have been fixed.

http://www.itninja.com/question/registry-script-fails-with-k1000



1 Comment   [ + ] Show comment
  • All pertinent data relative to the script has been replaced with '...'. The remarks are enough to follow along with installation program.



    ECHO %PROCESSOR_ARCHITEW6432%
    IF "%PROCESSOR_ARCHITEW6432%"=="AMD64" GOTO _Native

    ECHO "This is running from a 64bit command prompt, on a 64bit OS."
    REM Create log directory

    REM Install Corel Painter

    REM Turn off EULA from HKLM
    REG.EXE ADD ...

    REM Import Default User Key (Turn off EULA)
    REM Load Default User HIVE
    REG.EXE LOAD HKU\DEFAULT C:\Users\Default\NTUser.dat

    REM Turn off EULA within Default User hive
    REG.EXE ADD ...
    REM Import Registration (disable) settings, to prevent dialog from opening on Painter 2017 launch
    REG.EXE IMPORT ...

    REM Unload Default User HIVE
    REG.EXE UNLOAD HKU\DEFAULT

    REM End of 'normal' scripting, goto end of program (skipping native section).
    GOTO _END

    REM Start of script using any needed C:\Windows\Sysnative\[command] changes
    :_Native

    ECHO "This is running from a 32bit command prompt, on a 64bit OS."

    REM Create log directory

    REM Install Corel Painter

    REM Turn off EULA from HKLM
    C:\Windows\Sysnative\REG.EXE ADD ...

    REM Import Default User Key (Turn off EULA)
    REM Load Default User HIVE
    C:\Windows\Sysnative\REG.EXE LOAD HKU\DEFAULT C:\Users\Default\NTUser.dat

    REM Turn off EULA within Default User hive
    C:\Windows\Sysnative\REG.EXE ADD ...
    REM Import Registration (disable) settings, to prevent dialog from opening on Painter 2017 launch
    C:\Windows\Sysnative\REG.EXE IMPORT ...

    REM Unload Default User HIVE
    C:\Windows\Sysnative\REG.EXE UNLOAD HKU\DEFAULT

    REM End of native scripting, goto end of program.
    GOTO _END


    :_END - mz6569 6 years ago

Answers (1)

Answer Summary:
Posted by: mz6569 6 years ago
White Belt
0

Top Answer

I see no reason why not but I use SCCM. One weird gotcha is sometime things are ran using CMD in c:\Windows\SysWOW64\CMD.exe and requires C:\Windows\Sysnative\REG.exe to be used in OS Deploy sequences to make sure it hits the correct part of the registry.

It's an idea ...

Comments:
  • That worked, by adding C:\Windows\Sysnative\REG.exe.

    Thanks for the answer and for teaching me something new.. - Jkimberlin 6 years ago
    • Sounds like Kace is running your deployment via C:\Windows\Syswow64\cmd.exe.

      Open both C:\Windows\System32\cmd.exe and C:\Windows\Syswow64\cmd.exe side by side and run 'SET PROC' and compare the results.

      You'll see the addition of PROCESSOR_ARCHITEW6432 in syswow64\cmd.exe

      You also run a 'dir C:\windows\sysnative' in syswow64\cmd.exe. But it will fail on the other.

      C:\Windows\sysnative\ from the 32bit command prompt actually references C:\Windows\System32 if you were to look at it through explorer.

      I use PROCESSOR_ARCHITEW6432 as a check to allow me to create 1 script to run manually, during an OS deployment or a normal system push. Posting the code in another comment.


      Oddly enough, SCCM uses
      - C:\Windows\syswow64\cmd.exe during a OS Task Sequence.
      - C:\Windows\system32\cmd.exe when sending a push program.

      At one point I had to maintain 2 installer scripts for anything that required import/copy/etc in the hosts C:\Windows\System32 directory. Now I use the logic posted in my other comment to allow me to maintain only 1 installer script.

      Hope this helps with Kace management. - mz6569 6 years ago
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ