Solved

VB Script for Last Access Date for a DLL

Posted on 2014-04-30
3
337 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 500 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
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…

688 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