<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Edwin M Sarmiento&gt;Check if an application is installed on workstations &#8211; Edwin M Sarmiento</title>
	<atom:link href="https://www.edwinmsarmiento.com/check-if-an-application-is-installed-on-workstations/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.edwinmsarmiento.com</link>
	<description>Intentional Excellence</description>
	<lastBuildDate>Mon, 13 Apr 2026 21:00:49 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
<site xmlns="com-wordpress:feed-additions:1">84283043</site>		<item>
		<title>&gt;Check if an application is installed on workstations</title>
		<link>https://www.edwinmsarmiento.com/check-if-an-application-is-installed-on-workstations/</link>
		<comments>https://www.edwinmsarmiento.com/check-if-an-application-is-installed-on-workstations/#comments</comments>
		<pubDate>Wed, 19 Dec 2007 01:41:00 +0000</pubDate>
		<dc:creator>Edwin M Sarmiento</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">http://bassplayerdoc.wordpress.com/2007/12/19/check-if-an-application-is-installed-on-workstations</guid>

				<description><![CDATA[&#62;Last week, a friend of mine asked me if there is a way to determine if an application is installed in a workstation. He was planning to deploy IBM Lotus Sametime Connect on their network but didn&#8217;t know which workstations already have it. I already have a script which audits a workstation&#8217;s hardware and software [&#8230;]]]></description>
					<content:encoded><![CDATA[<p>&gt;<span style="font-family:arial;">Last week, a friend of mine asked me if there is a way to determine if an application is installed in a workstation. He was planning to deploy IBM Lotus Sametime Connect on their network but didn&#8217;t know which workstations already have it. I already have a <a href="http://bassplayerdoc.blogspot.com/2007/10/using-wmi-and-vbscript-to-audit-your.html">script </a>which audits a workstation&#8217;s hardware and software so I was thinking of using this ith a little modification. He has a list of workstations in their network and he wants to use this as a reference. Here&#8217;s a script which reads the text file computerList.txt containing the hostnames of workstations in your network, tries to run a PING test to see if the workstation is reachable and, if it is, runs the script to check if the application is installed. All of these generates a result which is written to a text file in CSV format so that anybody can open it in Excel to generate reports. Management loves Excel.</span></p>
<p><span style="font-family:arial;">One thing to note is that you can change the application name to anything you wish provided you know the complete application name as stored in your Add/Remove Programs or the registry. If you want to read the hostnames from your Active Directory infrastructure, check out the script written by <a href="http://www.mljenkins.com/sysadmin/windows/findapp.html">Matthew Jenkins</a> (I actually validated my script against his as it is always good to have your work checked). So Raymond, this post is for you.  You no longer have to go thru all 2000+ workstations in your network</span></p>
<p><span style="font-family:lucida grande;font-size:85%;color:#000099;"><strong>Dim loopCount, directory, objFSO,objFile,objFSO2,objFile2</strong></span></p>
<p><span style="font-family:lucida grande;font-size:85%;color:#000099;"><strong>&#8216;Gets the directory where our script is running from<br />directory = CreateObject(&#8220;Scripting.FileSystemObject&#8221;).GetParentFolderName(Wscript.ScriptFullName)</strong></span></p>
<p><span style="font-family:lucida grande;font-size:85%;color:#000099;"><strong></strong></span></p>
<p><span style="font-family:lucida grande;font-size:85%;color:#000099;"><strong>Set objFSO = CreateObject(&#8220;Scripting.FileSystemObject&#8221;)<br />Set objFile = objFSO.OpenTextFile(directory &amp; &#8220;computerList.txt&#8221;, 1)</strong></span></p>
<p><span style="font-family:lucida grande;font-size:85%;color:#000099;"><strong></strong></span></p>
<p><span style="font-family:lucida grande;font-size:85%;color:#000099;"><strong>&#8216;===LOG of servers with successful PING<br />strFilePath = directory &amp; &#8220;Results.csv&#8221;<br />Set objFSO2 = CreateObject(&#8220;Scripting.FileSystemObject&#8221;)<br />&#8216; Open the file for write access.<br />On Error Resume Next<br />Set objFile2 = objFSO2.OpenTextFile(strFilePath, 2, True, 0)<br />If (Err.Number &lt;&gt; 0) Then<br />On Error GoTo 0<br />Wscript.Echo &#8220;File &#8221; &amp; strFilePath &amp; &#8221; cannot be opened&#8221;<br />Set objFSO2 = Nothing<br />End If<br />On Error GoTo 0</strong></span></p>
<p><span style="font-family:lucida grande;font-size:85%;color:#000099;"><strong></strong></span></p>
<p><span style="font-family:lucida grande;font-size:85%;color:#000099;"><strong>&#8216;Write HEADER<br />objFile2.WriteLine &#8220;SERVER,PING STATUS, SOFTWARE INSTALLED&#8221;</strong></span></p>
<p><span style="font-family:lucida grande;font-size:85%;color:#000099;"><strong>&#8216;variable to search for a specified application<br />strApp=&#8221;IBM Lotus Sametime Connect&#8221;</strong></span></p>
<p><span style="font-family:lucida grande;font-size:85%;color:#000099;"><strong>Do Until objFile.AtEndOfStream<br /> strComputer = objFile.ReadLine<br /> If Reachable(strComputer)=&#8221;Success&#8221; Then<br />                 intResult = SearchApp(strComputer, strApp)<br />                 If(intResult = 1) Then<br />                         strInstalled = &#8220;INSTALLED&#8221;<br />                 ElseIf(intResult = 2) Then<br />                         strInstalled = &#8220;NONE&#8221;<br />                 ElseIf(intResult = 3) Then<br />                         strInstalled = &#8220;UNABLE TO QUERY&#8221;<br />                 End If</strong></span></p>
<p><span style="font-family:lucida grande;font-size:85%;color:#000099;"><strong>  objFile2.WriteLine strComputer &amp; &#8220;,SUCCESS,&#8221; &amp; strInstalled<br /> Else<br />  objFile2.WriteLine strComputer &amp; &#8220;,&#8221; &amp; Reachable(strComputer) &amp;  &#8220;,N/A&#8221; <br /> End If<br />Loop</strong></span></p>
<p><span style="font-family:lucida grande;font-size:85%;color:#000099;"><strong>objFile.Close<br />Set objFSO =NOTHING<br />Set objFile = NOTHING</strong></span></p>
<p><span style="font-family:lucida grande;font-size:85%;color:#000099;"><strong>objFile2.Close<br />Set objFSO2 =NOTHING<br />Set objFile2 = NOTHING</strong></span></p>
<p><span style="font-family:lucida grande;font-size:85%;color:#000099;"><strong>MSGBOX &#8220;Finished&#8221;</strong></span></p>
<p><span style="font-family:lucida grande;font-size:85%;color:#000099;"><strong></strong></span></p>
<p><span style="font-family:lucida grande;font-size:85%;color:#000099;"><strong>&#8216;===================================<br />&#8216; Function SearchApp(strComputer, sApplication)<br />        On Error Resume Next</strong></span></p>
<p><span style="font-family:lucida grande;font-size:85%;color:#000099;"><strong>        &#8216; Initialize some variables first<br />        SearchApp = 2<br />        sProgramName = &#8220;&#8221;<br />        sProgramVersion = &#8220;&#8221;<br />        sKeyPath = &#8220;SOFTWAREMicrosoftWindowsCurrentVersionUninstall&#8221;       &#8216; key containing uninstall info</strong></span></p>
<p><span style="font-family:lucida grande;font-size:85%;color:#000099;"><strong>        &#8216; Attempt to connect to client&#8217;s registry<br />        Const HKLM = &amp;H80000002 &#8216;HKEY_LOCAL_MACHINE<br />        Set oReg = GetObject(&#8220;winmgmts:\&#8221; &amp; strComputer &amp; &#8220;rootdefault:StdRegProv&#8221;)</strong></span></p>
<p><span style="font-family:lucida grande;font-size:85%;color:#000099;"><strong>        &#8216; Ensure we connected ok to the client, if not just return false, it&#8217;s probably not a valid Windows box<br />        If Err.Number &lt;&gt; 0 Then<br />                SearchApp = 3<br />                Exit Function<br />        End If</strong></span></p>
<p><span style="font-family:lucida grande;font-size:85%;color:#000099;"><strong>        &#8216; Enumerate client registry looking for application<br />        oReg.EnumKey HKLM, sKeyPath, arrSubKeys &#8216; get installed programs&#8217; subkeys<br />        For Each subKey In arrSubKeys &#8216; get info from each installed program subkey<br />                &#8216; attempt to get DisplayName<br />                If(oReg.GetStringValue(HKLM, sKeyPath &amp; subKey, &#8220;DisplayName&#8221;, sProgramName) &lt;&gt; 0) Then<br />                        &#8216; if no DisplayName try for QuietDisplayName<br />                        oReg.GetStringValue HKLM, sKeyPath &amp; subKey, &#8220;QuietDisplayName&#8221;, sProgramName<br />                End If</strong></span></p>
<p><span style="font-family:lucida grande;font-size:85%;color:#000099;"><strong>                &#8216; attempt to get DisplayVersion<br />                If(oReg.GetStringValue(HKLM, sKeyPath &amp; subKey, &#8220;DisplayVersion&#8221;, sProgramVersion) &lt;&gt; 0) Then<br />                        &#8216; if no DisplayName try for QuietDisplayName<br />                        oReg.GetDWORDValue HKLM, sKeyPath &amp; subKey, &#8220;VersionMajor&#8221;, sProgramVersion<br />                End If</strong></span></p>
<p><span style="font-family:lucida grande;font-size:85%;color:#000099;"><strong>                &#8216; If the name exists, return true<br />                If sProgramName = sApplication Then<br />                        SearchApp = 1<br />                        Exit Function<br />                End If<br />        Next<br />End Function</strong></span></p>
<p><span style="font-family:lucida grande;font-size:85%;color:#000099;"><strong>&#8216;===================<br />Function Reachable(strComputername)</strong></span></p>
<p><span style="font-family:lucida grande;font-size:85%;color:#000099;"><strong>Dim wmiQuery, objWMIService, objPing, objStatus</strong></span></p>
<p><span style="font-family:lucida grande;font-size:85%;color:#000099;"><strong>wmiQuery = &#8220;Select * From Win32_PingStatus Where Address = &#8216;&#8221; &amp; strComputer &amp; &#8220;&#8216;&#8221;</strong></span></p>
<p><span style="font-family:lucida grande;font-size:85%;color:#000099;"><strong>Set objWMIService = GetObject(&#8220;winmgmts:\.rootcimv2&#8221;)<br />Set objPing = objWMIService.ExecQuery(wmiQuery)</strong></span></p>
<p><span style="font-family:lucida grande;font-size:85%;color:#000099;"><strong>For Each objStatus in objPing</strong></span></p>
<p><span style="font-family:lucida grande;font-size:85%;color:#000099;"><strong>SELECT CASE objStatus.StatusCode<br /> CASE 0<br />  Reachable=&#8221;Success&#8221;<br /> CASE 11001<br />  Reachable=&#8221;Buffer Too Small&#8221;<br /> CASE 11002<br />  Reachable=&#8221;Destination Net Unreachable&#8221;<br /> CASE 11003<br />  Reachable=&#8221;Destination Host Unreachable&#8221;<br /> CASE 11004<br />  Reachable=&#8221;Destination Protocol Unreachable&#8221;<br /> CASE 11005<br />  Reachable=&#8221;Destination Port Unreachable&#8221;<br /> CASE 11006<br />  Reachable=&#8221;No Resources&#8221;<br /> CASE 11007<br />  Reachable=&#8221;Bad Option&#8221;<br /> CASE 11008<br />  Reachable=&#8221;Hardware Error&#8221;<br /> CASE 11009<br />  Reachable=&#8221;Packet Too Big&#8221;<br /> CASE 11010<br />  Reachable=&#8221;Request Timed Out&#8221;<br /> CASE 11011<br />  Reachable=&#8221;Bad Request&#8221;<br /> CASE 11012<br />  Reachable=&#8221;Bad Route&#8221;<br /> CASE 11013<br />  Reachable=&#8221;TimeToLive Expired Transit&#8221;<br /> CASE 11014<br />  Reachable=&#8221;TimeToLive Expired Reassembly&#8221;<br /> CASE 11015<br />  Reachable=&#8221;Parameter Problem&#8221;<br /> CASE 11016<br />  Reachable=&#8221;Source Quench&#8221;<br /> CASE 11017<br />  Reachable=&#8221;Option Too Big&#8221;<br /> CASE 11018<br />  Reachable=&#8221;Bad Destination&#8221;<br /> CASE 11032<br />  Reachable=&#8221;Negotiating IPSEC&#8221;<br /> CASE 11050<br />  Reachable=&#8221;General Failure&#8221;<br />END SELECT<br />Next<br />End Function</strong></span></p>
<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/92377218009570869-8183128559079578654?l=bassplayerdoc.blogspot.com' alt='' /></div>
]]></content:encoded>
			

		<wfw:commentRss>https://www.edwinmsarmiento.com/check-if-an-application-is-installed-on-workstations/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
				<post-id xmlns="com-wordpress:feed-additions:1">63</post-id>	</item>
	</channel>
</rss>