I found this script for killing ALL open file sessions:
but i just want to kill one open file session. I tried doing this:
I thought somehow I could test to see if the session existed with something like this:
Can someone help me out?
Set objConnection = GetObject("WinNT://atl-ws-01/LanmanServer")
Set colSessions = objConnection.Sessions
For Each objSession in colSessions
colSessions.Remove(objSession.Name)
Next
but i just want to kill one open file session. I tried doing this:
but then I get an error if the session does not exist (which sometimes it won't) and then the scheduled task hangs open.Set objConnection = GetObject("WinNT://CSVS03/LanmanServer")
Set colSessions = objConnection.Sessions
colSessions.Remove("ADMINISTRATOR\GISS04")
I thought somehow I could test to see if the session existed with something like this:
but now I get a compile error saying "Object required: 'objSession'"Set objConnection = GetObject("WinNT://CSVS03/LanmanServer")
Set colSessions = objConnection.Sessions
if (objSession.Name("ADMINISTRATOR\GISS04")) Then
colSessions.Remove("ADMINISTRATOR\GISS04")
end if
Can someone help me out?