thread329-462925
Hi guys, the below script, submitted by browolf, is exactly what I need but I can't get it to search for other users but my own. How do I get it to check other users:
<code>
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 = "\\server\logs\" & lcase(cname) & ".txt"
path2 = "\\server\logs\" & lcase(uname) & ".txt"
path3 = "\\server\logs\shortcuts\" & lcase(cname) & ".txt"
If (fso.FileExists(path3)) Then
fso.DeleteFile(path3)
end if
Set f1 = fspenTextFile(path1, ForAppending, True)
Set f2 = fspenTextFile(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"
</code>
This script also gives the current date and time, is there a way to check the last time used or time logged on.
Thanks
Hi guys, the below script, submitted by browolf, is exactly what I need but I can't get it to search for other users but my own. How do I get it to check other users:
<code>
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 = "\\server\logs\" & lcase(cname) & ".txt"
path2 = "\\server\logs\" & lcase(uname) & ".txt"
path3 = "\\server\logs\shortcuts\" & lcase(cname) & ".txt"
If (fso.FileExists(path3)) Then
fso.DeleteFile(path3)
end if
Set f1 = fspenTextFile(path1, ForAppending, True)
Set f2 = fspenTextFile(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"
</code>
This script also gives the current date and time, is there a way to check the last time used or time logged on.
Thanks