/build/static/layout/Breadcrumb_cap_w.png

Issue with reg query in scripting.

Hello Ninjas, 

I'm currently working on scripted installations for work from the Scripting tab in k1000. We have found utilizing this to run batch-scripts is VERY powerful, per dell support recommending it.

If we run either of the scripts as .bat files from the local desktop, not pushed from the k1000 as a script, it works just fine.

Here are two scripts. Script 1 will not work, the reg queries simply do not run.


Script 1: NOT WORKING
reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{C3BA73A4-2A45-4036-8541-4F5F8146078B} >NUL 2>NUL && MSIEXEC.EXE /X {C3BA73A4-2A45-4036-8541-4F5F8146078B} /qb- /norestart
timeout 15
reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{104875A1-D083-4A34-BC4F-3F635B7F8EF7} >NUL 2>NUL && MSIEXEC.EXE /X {104875A1-D083-4A34-BC4F-3F635B7F8EF7} /qb- /norestart
timeout 15
reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{1E26B9C2-ED08-4EEA-83C8-A786502B41E5} >NUL 2>NUL && MSIEXEC.EXE /X {1E26B9C2-ED08-4EEA-83C8-A786502B41E5} /qb- /norestart
timeout 15
echo Previous versions of SPSS Removed
net use z:\\storage
echo Connected
msiexec.exe /i "z:\storage\IBM SPSS Statistics 23.msi" /qb- INSTALLDIR="C:\Program Files\IBM" COMPANYNAME="foo" LICENSETYPE="Network" LSHOST="bar"

echo SPSS23-Installed

net use z: /d /y


Script 2: This is working
@echo off

MSIEXEC.EXE /X {1E26B9C2-ED08-4EEA-83C8-A786502B41E5} /qb- /norestart
echo SPSS21-Removed
net use z: \\storage
echo Connected
msiexec.exe /i "z:\storage\IBM SPSS Statistics 23.msi" /qb- INSTALLDIR="C:\Program Files\IBM" COMPANYNAME="foo" LICENSETYPE="Network" LSHOST="bar"
echo SPSS23-Installed
net use z: /d /y



If we can reg query, this would work SO much better with our setup. If not we need scripts for removal of everything else. Any help would be much appreciated.


0 Comments   [ + ] Show comments

Answers (4)

Posted by: SMal.tmcc 5 years ago
Red Belt
1

The client is 32 bit so to query the 64bit registry you need to use HKLM64\software\....  or call the reg.exe using the sysnative path so it calls the 64bit exe vs the 32bit exe found in windows\syswow64\

Posted by: andycorps 5 years ago
Senior White Belt
0

This is a little old... but I knocked out a reasonably neat solution for uninstalling all old versions using their GUIDs that seems to work OK. First compile a text file containing all the GUIDs you want to remove (including the {}'s)
Then put a script with the following in the same folder:

FOR /f "delims=" %%G in (%~dp0SolidWorksGUID.txt) DO reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%%G && MSIEXEC.EXE /x %%G /qn
I'm using it to remove several years worth of Solidworks (and its various components) before installing the latest...
Posted by: rad33k 7 years ago
Fourth Degree Brown Belt
0
If your 'reg query' command needs to reach out 64bit registry, you should try with:
"%WINDIR%\SYSNATIVE\REG.EXE" as it seems that K1000 agent works in a 32bit environment (I'm guessing, I've never used K1000 but this helped in this question).
Posted by: anonymous_9363 7 years ago
Red Belt
0
If you're running the script in System context, be aware that the System account has zero access to network resources so mapped drives etc. will not work.
 
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