This will work
Dim fso
Set fso = Wscript.CreateObject("Scripting.FileSystemObject")
Dim shl
Set shl = WScript.CreateObject("WScript.Shell")
If fso.FileExists("c:\path\foo\bar.txt") Then
Dim theFile
Set theFile = fso.GetFile("c:\path\foo\bar.txt")
Dim outFile
Set outFile =
fso.CreateTextFile(shl.ExpandEnvironmentStrings("\\someserver\logshare\%username%.txt"),
true)
outFile.WriteLine Now & "," & theFile.Name & "," & theFile.Size
outFile.Close
End If
Toss a second script on the share to catalog all the data. I used a separate
file for each user to alleviate locking issues. If you want to do historical
trending change the true to a false and it will append.
I would add an On Error Resume Next also or log an event on error.
Thanks,
Brian Desmond
[email protected]
c - 312.731.3132
From: David [mailto:[email protected]]
Sent: Thursday, March 26, 2009 4:54 PM
To: NT System Admin Issues
Subject: Pulling data with logon script?
We're using a fairly simple VB logon script -- I'm wondering if I can call a
routine in that script to find out how many users have a file with a certain
extension in a specific location on their machines -- I'd be looking to write
or add to a network text file when a user logs on, to get the name of the file,
the date, and size. If anyone has used or seen a similar routine I'd
appreciate hearing about it. Haven't done a great deal of my own scripting.
Thanks.
David
_____________________
The problem with socialism is that you
eventually run out of other people's money.
~ Margaret Thatcher
~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~