?
Solved

VB Script for Last Access Date for a DLL

Posted on 2014-04-30
3
Medium Priority
?
343 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

649 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