Solved

Close open files and RDP Session

Posted on 2014-02-17
10
759 Views
Last Modified: 2014-02-18
I need some help in setting up a scheduled task that will log off all users from a terminal server and close any and all open files.  I have users disconnecting instead of logging off of the the server and this is causing and index function that runs as a scheduled task to fail every night.  I have tried to get tslogoff.exe to work but with no success on a 2008 R2 server.  I do not know how to add cmdlets to Powershell or even how to get a script to run correctly.  I have downloaded handle.exe from sysinternals but do not know what i need to do to get the cmdlets installed and create a script to log off the users that disconnected and close the open files.  I know this should be easy but i am not having any success and need assistance please.
I have tried to follow this article but i must be missing something.
http://www.experts-exchange.com/Microsoft/Applications/Q_27494075.html
0
Comment
Question by:digitalsoup
  • 5
  • 4
10 Comments
 
LVL 15

Expert Comment

by:Jaroslav Mraz
Comment Utility
Hi,

Why you simple dont use built in policy? You can setup idle time for user and after idle time disconect user and then time he can reconect and after this time is reached hes sesion will be ended.

We have this 30 a 30 minutes becouse sometimes its auto update what disconect sesion

http://www.ryanbelanger.com/remote-desktop-session-automatic-logoff-on-windows-2008-r2/
0
 
LVL 2

Expert Comment

by:Sylvain_piv
Comment Utility
Yes make a policy.

Or if you want you can do that on the tscc.msc console on the tcp properties.
0
 

Author Comment

by:digitalsoup
Comment Utility
I cannot afford to simply boot a disconnected user.  I need to close the files and applications that are open in order to prevent data corruption.  We need a process that closes the open files and connections for disconnected or even logged in users.  If i simply "End Task" i get lots of errors in the index records.  I need a powershell script to do this and i know it is supported i just can't figure out how to make it happen.
0
 

Author Comment

by:digitalsoup
Comment Utility
can someone please help me to get handle.exe running and registered in powershell?  Does it require version 2 or higher?
0
 
LVL 15

Expert Comment

by:Jaroslav Mraz
Comment Utility
To manage ts from powershel you can use http://code.msdn.microsoft.com /PSTerminalServices
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 15

Accepted Solution

by:
Jaroslav Mraz earned 500 total points
Comment Utility
0
 

Author Comment

by:digitalsoup
Comment Utility
now that put me in the right direction.  I got psterminalservices module loaded.  Now i need to write the script to log off any/all users so that i can schedule it.  I am running powershell v2.0
0
 
LVL 15

Expert Comment

by:Jaroslav Mraz
Comment Utility
The example you need is on website



# Logs off all the active sessions from remote computer 'comp1', no confirmations
PS > Get-TSSession -ComputerName comp1 -State Active | Stop-TSSession –Force


Without force you manualy need to confirm
0
 
LVL 15

Expert Comment

by:Jaroslav Mraz
Comment Utility
Comp1 can be server name or localhost
0
 

Author Closing Comment

by:digitalsoup
Comment Utility
Thank you for assisting me with this process.  It works great now.
0

Featured Post

Shouldn't all users have the same email signature?

You wouldn't let your users design their own business cards, would you? So, why do you let them design their own email signatures? Think of the damage they could be doing to your brand reputation! Choose the easy way to manage set up and add email signatures for all users.

Join & Write a Comment

INTRODUCTION The purpose of this document is to demonstrate the Installation and configuration of the Data Protection Manager product. Note that this demonstration was prepared on the basis of Windows OS is 2008 R2 and DPM 2010. DATA PROTECTI…
A procedure for exporting installed hotfix details of remote computers using powershell
This tutorial will walk an individual through locating and launching the BEUtility application and how to execute it on the appropriate database. Log onto the server running the Backup Exec database. In a larger environment, this would generally be …
This tutorial will walk an individual through the steps necessary to configure their installation of BackupExec 2012 to use network shared disk space. Verify that the path to the shared storage is valid and that data can be written to that location:…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now