I'm running a robocopy script to backup a server and I'm using net stop and taskkill to terminate services and processes that could cause the script to fail or miss important files, but how do I close any open files or folders on network shares (in case a client PC left stuff open when they went home)??

有帮助吗?

解决方案

There are two ways you can do this easily via a batch script:

NET SESSION \\computername /delete

or

SC RESTART LanmanServer

The first terminates all sessions for the specified computer name. The latter stops and restarts the file server, which would effectively terminate all sessions.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top