Skip navigation

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


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 HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall or the contents of the DisplayName Value Name.

Answer                is a call directed environment variable 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 off
If \{%3\}

\{\} @echo Syntax: Installed ComputerName DisplayName_Or_SubKey Answer&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&set %3=%OK%

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 off
If \{%1\}\{\} @echo Syntax: UninstallString ComputerName&goto :EOF
setlocal
set key=\\%1\HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall /s
for /f "Tokens=*" %%a in ('reg query %key%^|FINDSTR /I /L "HKEY_LOCAL_MACHINE DisplayName UninstallString"') do (
 @echo %%a
)
endlocal



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish