Solved

Terminal Services - VBScript - Trying to log off user with warning / delay

Posted on 2013-06-28
6
481 Views
Last Modified: 2013-07-03
I have the following piece of code that forcefully logs a user off of a terminal server right away:

Set objShell = WScript.CreateObject("WScript.Shell")
objShell.run "shutdown.exe -L -F"

Open in new window


That works perfectly. I'm trying to introduce the -T variable to it so that it logs off with a warning, but when I do the command doesn't run.

Is this possible?
0
Comment
Question by:street9009
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 32

Expert Comment

by:Robberbaron (robr)
ID: 39286286
for my pc (win8), the switches to shutdown are / prefixed.

but also the help notes that using /t implies /f so
shutdown /l /t 045

Open in new window

  should be the same
0
 

Author Comment

by:street9009
ID: 39290526
Somehow this shutdown.exe that's being called in VBScript is different than the traditional command line version. I notice that the -F is being called with a - and not a / for starters. And when I add /t or -T or -t, it doesn't run. I don't know how or why it's different, but something is.
0
 
LVL 15

Expert Comment

by:ZabagaR
ID: 39294430
What OS and edition? Windows 2008 R2 for instance?

From what I've read, you cannot use the /l parameter and the /t parameter together.

I tried it myself on a Windows 2008 terminal server, same issue as you.

http://pcsupport.about.com/od/commandlinereference/p/shutdown-command.htm
0
Industry Leaders: 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!

 

Author Comment

by:street9009
ID: 39296736
Correct, Server 2008 R2. I'm trying to force a polite log-off with at least a little warning.
0
 
LVL 15

Accepted Solution

by:
ZabagaR earned 500 total points
ID: 39296910
Put this code in front of your own log off script:

A box will pop up telling the user that they'll be logged out in 5 seconds (TIMEOUT value).
If they wait 5 seconds, the box will disappear and they'll be logged out.  If they click the OK button before 5 seconds they'll be logged out.

Const TIMEOUT = 5
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Popup "Logging off in 5 seconds", TIMEOUT
0
 

Author Closing Comment

by:street9009
ID: 39297997
Worked like a champ. Thank you!
0

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

Script to copy or move mouse-selected collection of files plus targets referenced by shortcuts (.lnk) The purpose of this article is to help illuminate the real challenges and options available (where they may exist) for utilizing simple scriptin…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

726 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