Disconnecting user sessions to a shared folder by task scheduler

Adrian Nazar 1 Reputation point
2022-03-11T08:10:37.11+00:00

Does anyone know of a command that disconnects all user sessions to a shared folder? I would like to add resetting user sessions to a schedule for example every four hours. Now I have to do it manually "Computer management -> Shared folders ->Sessions -> Reset all sessions".

Windows for business Windows Server User experience Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 39,916 Reputation points
    2022-03-16T14:50:37.747+00:00

    Hi @Adrian Nazar

    Yes, you can disconnect a user or all users from a shared folder or drive by using a command line.

    -open an elevated Command Prompt
    Type:
    net session \<computer> /delete

    For example, to disconnect a user on a computer named user_computer, which is connected to a shared folder that you are managing, type:

    net session \user_computer /delete

    Hope this resolves your Query!!

    --
    --If the reply is helpful, please Upvote and Accept it as an answer–

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.