vbs auto closing message box on log off

Posted on 2009-02-23
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

    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.
    LVL 1

    Author Comment

    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

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    If your system is showing symptoms of browser hijacks or 'google search redirects' check out my other article ( first and run the tool TDSSKiller ( to get rid of the infection. Once done, and if the …
    This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    734 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

    22 Experts available now in Live!

    Get 1:1 Help Now