The script below was written to check whether if teamviewer is installed or not, and for what architecture it will retrieve the ClientID, transform it to decimal and print it to a file.
Everytime, whether it's installed or not, the result of this script is "Teamviewer not installed"
I could not find any mistake in the logic of this script.
reg query "HKLM\Software\TeamViewer" /v "ClientID"
if %ERRORLEVEL% == 1 (
reg query "HKLM\Software\Wow6432Node\TeamViewer" /v "ClientID"
if %ERRORLEVEL% == 1 (
echo TEAMVIEWER NOT INSTALLED >> %computername%.nfo
) else (
for /f "tokens=3" %%a in ('reg query "HKLM\Software\Wow6432Node\TeamViewer" /v "ClientID"') do (
set /a decimal=%%a + 0
echo TEAMVIEWER ID: >> %computername%.nfo
echo %decimal% >> %computername%.nfo
)
)
) else (
for /f "tokens=3" %%a in ('reg query "HKLM\Software\TeamViewer" /v "ClientID"') do (
set /a decimal=%%a + 0
echo TEAMVIEWER ID: >> %computername%.nfo
echo %decimal% >> %computername%.nfo
)
)