JSI Tip 8700. How can I determine if an application is installed on a remote computer?

Jerold Schulman

November 18, 2004

1 Min Read
ITPro Today logo in a gray background | ITPro Today


I have scripted Installed.bat to determine if an application is installed on a remote computer.

The syntax for using Installed.bat is:

Installed ComputerName DisplayName_Or_SubKey Answer

Where:

ComputerName          is the NetBIOS name of the remote computer.DisplayName_Or_SubKey is either the sub-key of HKLMSoftwareMicrosoftWindowsCurrentVersionUninstall or the contents of the DisplayName Value Name.Answer                is a <a href="https://www.itprotoday.com/article/jsifaq/jsi-tip-5535-how-can-i-cause-a-called-batch-file-to-return-a-call-directed-environment-variable-.aspx">call directed environment variable</a> that will contain a Y or an N.

NOTE: Installed.bat uses REG.EXE, built into Windows XP and latter, or installed from the Support Tools on the Windows 2000 CD-ROM.

Installed.bat contains:

@echo offIf {%3}
<h1><a name="_echo_Syntax_Installed_ComputerName_DisplayName_Or_SubKey_Answer_amp_goto_EOF_setlocal_set_OK_N_set_key_1_HKLM_Software_Microsoft_Windows_CurrentVersion_Uninstall_s_set_findit_2_set_findit_findit_for_f_Tokens_a_in_reg_query_key_FINDSTR_I_L_C_findit_do_set_OK_Y_endlocal_amp_set_3_OK_pre_b_NOTE_b_To_uninstall_the_program_remotely_use_a_href_article_jsifaq_jsi_tip_4141_psexec_freeware_executes_programs_remotely_aspx_b_PsExec_exe_b_a_to_run_the_string_in_the_b_UninstallString_b_Value_Name_To_locate_the_b_UninstallString_b_run_b_UninstallString_ComputerName_b_where_b_UninstallString_bat_b_contains_pre_echo_off_If_1_" id="_echo_Syntax_Installed_ComputerName_DisplayName_Or_SubKey_Answer_amp_goto_EOF_setlocal_set_OK_N_set_key_1_HKLM_Software_Microsoft_Windows_CurrentVersion_Uninstall_s_set_findit_2_set_findit_findit_for_f_Tokens_a_in_reg_query_key_FINDSTR_I_L_C_findit_do_set_OK_Y_endlocal_amp_set_3_OK_pre_b_NOTE_b_To_uninstall_the_program_remotely_use_a_href_article_jsifaq_jsi_tip_4141_psexec_freeware_executes_programs_remotely_aspx_b_PsExec_exe_b_a_to_run_the_string_in_the_b_UninstallString_b_Value_Name_To_locate_the_b_UninstallString_b_run_b_UninstallString_ComputerName_b_where_b_UninstallString_bat_b_contains_pre_echo_off_If_1_">{} @echo Syntax: Installed ComputerName DisplayName_Or_SubKey Answer&amp;goto :EOFsetlocalset OK=Nset key=\%1HKLMSoftwareMicrosoftWindowsCurrentVersionUninstall /sset findit=%2set findit=%findit:"=%for /f "Tokens=*" %%a in ('reg query %key%^|FINDSTR /I /L /C:"%findit%"') do ( set OK=Y)endlocal&amp;set %3=%OK%</a></h1>

NOTE: To uninstall the program remotely, use PsExec.exe to run the string in the UninstallString Value Name. To locate the UninstallString, run UninstallString ComputerName, where UninstallString.bat contains:

@echo offIf {%1}{} @echo Syntax: UninstallString ComputerName&goto :EOFsetlocalset key=\%1HKLMSoftwareMicrosoftWindowsCurrentVersionUninstall /sfor /f "Tokens=*" %%a in ('reg query %key%^|FINDSTR /I /L "HKEY_LOCAL_MACHINE DisplayName UninstallString"') do ( @echo %%a)endlocal



Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like