View Full Version : Kill session
tan125
03-30-2009, 08:48 AM
Sometimes I get Access Denied errors when trying to move/rename/delete folders because there are open sessions on the folders or files in question. If I go to Computer Management|System Tools|Shared Folders and kill any relevant open sessions/files out there, that works fine; then I can do when I need to do. Is there a way to do this in VBP?
kinook
03-30-2009, 09:15 AM
Searching on google for
computer management automate shared folders disconnect all sessions
The cached link for the second result
http://209.85.173.132/search?q=cache:EEW7fxcgG5IJ:www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/Q_22798036.html+computer+management+automate+share d+folders+disconnect+all+sessions&cd=2&hl=en&ct=clnk&gl=us&lr=lang_en
Suggests two possibilities.
VBScript (from a Run Script action):Set objConnection = GetObject("WinNT://computername/LanmanServer")
Set colSessions = objConnection.Sessions
For Each objSession in colSessions
colSessions.Remove(objSession.Name)
Nextor from a Run Program action:
net session \\computername /delete /y
http://www.ss64.com/nt/net_share.html
vBulletin® v3.8.11, Copyright ©2000-2024, vBulletin Solutions Inc.