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.