Learn how to a build a cloud-first strategyRegister Now


vbs auto closing message box on log off

Posted on 2009-02-23
Medium Priority
Last Modified: 2012-05-06
I'm trying to display a message on logoff for say 5 seconds "remove USB stick" then the message box closes itself. Waiting for user to click Ok is not good enough.
In the code below the 2nd line does not show , the 3rd line does. (in a log off script)
Run from the desktop the first box times out ok, the2nd box shows.
So somethings work on logoff some dont!
Set objShell = CreateObject("Wscript.Shell")
intReturn = objShell.Popup("Please make Sure Your USB stick is removed",15,"Warning")
wscript.echo "did you see timed"
Set ObjShell = Nothing

Open in new window

Question by:harveygs
LVL 14

Accepted Solution

rejoinder earned 2000 total points
ID: 23718635
I am unsure why the shell popup will not work when shutting down however, you might get away with using your group policy object timeout value, see link below.
You could have a wscript.echo command in the code and the policy would simply quit the script at the desired number of seconds.

Author Comment

ID: 23720495
I realised I did not dim objshell because I had on resume next further up.
So the popup does work on log off. I actually used a hta instead , and works nicely now.

Good thought about the time out of scripts , I set this to 1 minute for safety reasons.



Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
Integration Management Part 2
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Suggested Courses

810 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