Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Windows Batch File To Reset Remote Desktop Connection

Posted on 2009-04-30
Medium Priority
Last Modified: 2012-05-06

i have this command to reset desktop connection , i want this script to be run if i got msg max user exeded , the problem is the session got different ID each time .

so i need batch .BAT , to run this script and only put the ID # to reset

can anybody help??
net use /user:user\\server\share
query session /server:server
reset session # /server:server

Open in new window

Question by:palserv
1 Comment
LVL 72

Accepted Solution

Qlemo earned 1400 total points
ID: 24268210
You do not need to use a share to connect to the server. IPC$ connection is sufficient.
set /P allows for user prompt, and stores the input into a environment variable (no here).

@echo off
net use \\Server /u:User Pwd
query session /server:Server
set /P no=No. of session to reset: 
reset session /server:Server %no%
net use \\Server /d

Open in new window


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IF you are either unfamiliar with rootkits, or want to know more about them, read on ....
Each password manager has its own problems in dealing with certain websites and their login methods. In Part 1, I review the Top 5 Password Managers that I've found to be the best. In Part 2 we'll look at which ones co-exist together and why it'…
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question