?
Solved

VB Script for Last Access Date for a DLL

Posted on 2014-04-30
3
Medium Priority
?
340 Views
Last Modified: 2014-05-05
Hello,

I need a VB script that would read a computer name from a TXT file, look for a specific DLL file on that computer and return in a TXT file the computer name and the last access date for that file.  (in that case, i need to know when was the last date/time the VGX.DLL file was access, that file is locate in C:\Program Files\Common Files\Microsoft Shared\VGX).

Can you help me?

thanks
/mld
0
Comment
Question by:mldaigle1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 65

Accepted Solution

by:
RobSampson earned 2000 total points
ID: 40033739
Hi, try this VBS code.

Regards,

Rob.

Set objFSO = CreateObject("Scripting.FileSystemObject")
strFile = "C:\Program Files\Common Files\Microsoft Shared\VGX\vgx.dll"
strInput = "computers.txt"
strOutput = "log.csv"

Set objLog = objFSO.CreateTextFile(strOutput, True)
objLog.WriteLine """Computer"",""Last Accessed"""

Set objInput = objFSO.OpenTextFile(strInput, 1, False)
While Not objInput.AtEndOfStream
	strComputer = objInput.ReadLine
	If Ping(strComputer) = True Then
		strRemoteFile = "\\" & strComputer & "\" & Replace(strFile, ":", "$")
		If objFSO.FileExists(strRemoteFile) = True Then
			objLog.WriteLine """" & strComputer & """,""" & objFSO.GetFile(strRemoteFile).DateLastAccessed & """"
		Else
			objLog.WriteLine """" & strComputer & """,""<FILE NOT FOUND>"""
		End If
	Else
		objLog.WriteLine """" & strComputer & """,""<OFFLINE>"""
	End If
Wend
objLog.Close
objInput.Close

WScript.Echo "Done. Please see " & strOutput

Function Ping(strComputer)
	Dim objShell, boolCode
	Set objShell = CreateObject("WScript.Shell")
	boolCode = objShell.Run("Ping -n 1 -w 300 " & strComputer, 0, True)
	If boolCode = 0 Then
		Ping = True
	Else
		Ping = False
	End If
End Function

Open in new window

0
 

Author Closing Comment

by:mldaigle1
ID: 40041769
Hi Rob,

This is exactly what i needed.  Now I just need to adapt your script to check if it is an english or french station and it will be perfect.

thanks again,
/mld
:)
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 40041776
No problem. Thanks for the grade. WMI should be able to help you get the language.

Rob.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_266-VBScri…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question