/build/static/layout/Breadcrumb_cap_w.png

Scripting Question


Issue with reg query in scripting.

01/19/2017 1296 views
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

Comments



Community Chosen Answer

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\

Answered 08/16/2019 by: SMal.tmcc
Red Belt

All Answers

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...
Answered 08/16/2019 by: andycorps
Senior White 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).
Answered 01/19/2017 by: rad33k
Fourth Degree Brown 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.
Answered 01/20/2017 by: VBScab
Red Belt

 
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