Question : I have a shared folder that has a setup.exe. I want to record on all installations. Its a open read only share. How can i have a record.

Hi,

I have a shared folder that has a setup.exe. I want to record on all installations. Its a open read only share. How can i have a record.
Is there a script or a way that i can keep track on each installation of the user name / Machine name and date/time

REgards
Sharath

Answer : I have a shared folder that has a setup.exe. I want to record on all installations. Its a open read only share. How can i have a record.

You're right. I used an ID that's system specific. My fault. A version of the script, that should work, is below, but consider that you'll get 3 to 6 entries for every access, because Windows logs single operations (open, execute, close, etc.). It'd be possible to do something better, but needs extra time to develop.
Hope this could be enough.

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
sDate = Date ' for specific date use CDate("April 24, 2009")
sTargetEXE = "setup.exe" 'you can also use full or partial path
Const cISIdx = 2
Set dDate0 = CreateObject("WbemScripting.SWbemDateTime")
Set dDate1 = CreateObject("WbemScripting.SWbemDateTime")
Set dDateL = CreateObject("WbemScripting.SWbemDateTime")
dDate0.SetVarDate sDate, True
dDate1.SetVarDate sDate + 1, True
Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate,(Security)}!\\.\root\cimv2")
Set cEvts = oWMI.ExecQuery("Select * FROM Win32_NTLogEvent WHERE Logfile = 'Security' AND EventIdentifier = 560 AND TimeWritten >= '" & dDate0 & "' AND TimeWritten < '" & dDate1 & "'")
WScript.Echo "Date,Time,Program,User"
For Each oEvt in cEvts
	If Not isNull(oEvt.InsertionStrings) Then
		If InStr(oEvt.InsertionStrings(cISIdx), sTargetEXE) > 0 Then
			dDateL.Value = oEvt.TimeWritten
			dDateLog = dDateL.GetVarDate(True)
			Wscript.Echo Month(dDateLog) & "/" & Day(dDateLog) & "/" & Year(dDateLog) & "," & Hour(dDateLog) & ":" & Right("0" & Minute(dDateLog),2) & "." & Right("0" & Second(dDateLog),2) & "," & oEvt.InsertionStrings(cISIdx) & "," & oEvt.User
		End If
	End If
Next
Open in New Window Select All
Random Solutions  
 
programming4us programming4us