Originally posted by: Jamsan
I use it in production at work, so I know it works
How exactly do you have it configured? Do you have it tied through group policy for the correct OU as a logon script? Did you add the code to your already existing logon scripts? Did you properly modify the \\fileserver\share\ portion to a valid share in your current environment?
I added it in GP under logon scripts. I have the apporiate permissions set for file. I don't know it weird, I've tried multiple times and it doesn't work. I must be doing something wrong.
I said it has a .bat file
Anyway, so I was searching all over the internet and I found some code. I made a few changes but this seems to work just fine. However, I have to get it to append to the next line in the file.
See below....... VB Script file
on error resume next
'wscript.echo "Logging....."
const ForAppending = 8
dim net,fso,f
Set net = WScript.CreateObject("WScript.Network")
Set fso = CreateObject("Scripting.FileSystemObject")
set wshell = wscript.createobject("wscript.shell")
Set WshSysEnv = WShell.Environment("SYSTEM")
'uname = net.username
uname = wshell.ExpandEnvironmentStrings("%USERNAME%")
'wscript.echo "! " & uname
datetemp = date
ttemp = time
cname = net.ComputerName
'cname = wshell.ExpandEnvironmentStrings("%COMPUTERNAME%")
'path1=list of ppl who have used computer cname
'path2=list of computers person uname has used
'path3=list of shortcuts install in startmenu
path1 = "\\fileserver\Share\Logon Scripts\UsersPC\computer\logs\" & lcase(cname) & ".txt"
path2 = "\\ifileserver\Share\Logon Scripts\UsersPC\users\logs\" & lcase(uname) & ".txt"
path3 = "\\fileserver\Share\Logon Scripts\UsersPC\" & lcase(cname) & ".txt"
If (fso.FileExists(path3)) Then fso.DeleteFile(path3) end if
Set f1 = fs

penTextFile(path1, ForAppending, True)
Set f2 = fs

penTextFile(path2, ForAppending, True)
f1.writeline " was used by " & lcase(uname) & " on " & datetemp & " at " & ttemp
f2.writeline "used computer " & lcase(cname) & " on " & datetemp & " at " & ttemp
if WshSysEnv("OS")="" then
WShell.Run "%comspec% /c dir " & chr(34) & "c:\windows\start menu\*.lnk" & chr(34) & " /a-d /b /s >> " & path3 ,0,true
end if
f1.close
f2.close
'wscript.echo "Logging Done"