Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the batch processing of automatically disconnecting the access connection of network shares

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article is about how to implement batch processing that automatically disconnects access to network shares. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Applicable platform: WINDOWS 2K/XP HOME/PRO

Applicable environment: directory sharing or printer sharing, often unable to provide file and print sharing services to others due to reaching the connection limit of 10 people

Solution:

1. Pro version system, modify group policy secpol.msc/ local policy / security option / time required before suspending session to 1 minute

2. Use the following script to clear access connections every 30 seconds (or custom intervals)

The code is as follows:

@ echo off

Rem defines the cycle interval:

Set secs=30

Echo.

Echo =

Echo = = this script is used after the computer share access limit is reached = =

Echo = automatically disconnects some access connections after running the script = =

Echo = = query every% secs% seconds and execute the clear command = =

Echo =

Echo.

Net session > nul | | goto: error

: begin

Set clear=0

Echo.

For / f "tokens=1,2"% I in ('net session ^ | find "/') do (

Net session I / delete / y > nul 2 > & 1

Set clear=1

Echo% time:~0,8% clear access source:% I [% j]

)

Echo.

If% clear%==0 (echo% time:~0,8% no one is currently accessing this computer,% secs% seconds to continue.

) else (echo% time:~0,8% cleared,% secs% seconds to continue.)

Ping 127.0.0.1-n% secs%-w 0 > nul 2 > & 1

Goto begin

: error

Echo is not authorized to execute, please contact your administrator.

Echo.

Pause > nul 2 > & 1 | echo, please press any key to close.

Thank you for reading! This is the end of the article on "how to automatically disconnect the batch of network sharing access connections". I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report