?
Solved

Auto Log off VBscript does not run in scheduled task

Posted on 2014-07-17
5
Medium Priority
?
672 Views
Last Modified: 2014-08-06
Hi,

I am trying to run this test.vbs file through Windows Task scheduler.

set objShell = CreateObject("Wscript.Shell")

result = objShell.PopUp("You are going to be logged off, please save your work",60,"Logoff required", vbExclamation + vbOKCancel)

If result = 2 Then
      Wscript.echo "Logoff aborted"

Else 
      objShell.Run "Logoff.exe"
End If

Open in new window


But when I add this script to scheduled task it does not run. Message says "the task is currently running(0x41301) and nothing is showing on screen.
0
Comment
Question by:Educad
  • 2
  • 2
5 Comments
 
LVL 9

Expert Comment

by:nick2253
ID: 40202249
I'm assuming you've manually run the script and confirmed that it launches correctly.

You have to run the task as the logged in user.  Otherwise, it runs under the system account, and displays the message there (aka not on the user desktop).
0
 

Expert Comment

by:TerryZumwalt
ID: 40202260
I have had some issues with PowerShell and .VB Scripts in task scheduler but resolved them by writing a .bat file which executes the script.  The Batch file just executes the script you are trying to run.  I put the VB file on the root of the server or specified folder and the batch file would contain:  Start C:\%FilePath%\file.vbs   and I typically do not have any issues.

I also use:  shutdown -l  instead of logoff.exe.
0
 

Accepted Solution

by:
Educad earned 0 total points
ID: 40203648
When I ran the script manually on client machine, it worked but not through GPO. It is configured under Computer Configuration and gpo is linked to computer ou.

How do I run as the logged on user? I can see author is showing SYSTEM but run as my domain admin account.
0
 
LVL 9

Expert Comment

by:nick2253
ID: 40204539
http://technet.microsoft.com/en-us/library/cc725745.aspx

Under number 2, you want to be under "User Configuration" instead of "Computer Configuration".
0
 

Author Closing Comment

by:Educad
ID: 40243208
Nothing has been resolved..
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

Assume you have an outside contractor who comes in seasonally or once a week to do some work in your office, but you only want to give him access to the programs and files he needs and keep all other documents and programs private. Can you do this o…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
Suggested Courses
Course of the Month16 days, 1 hour left to enroll

850 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