Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Show message only when user is logged on

Status
Not open for further replies.

dseaver

IS-IT--Management
Jul 13, 2006
467
How would I make a message only appear if a user is logged on? I have a script that runs as a scheduled task nightly, and if there is a user on, I want it to display a message, and if there is no user, I obviously don't want a message shown so that i does not make the script hang
 
If a user is logged in then the process explorer.exe will exists...so just search for that using WMI (Win32_Process).

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
would setting a timeout on a msgbox work
e.g.

Const wshYes = 6
Const wshNo = 7
Const wshYesNoDialog = 4
Const wshQuestionMark = 32

Set objShell = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")

intReturn = objShell.Popup("Do you wish to run the scheduled task", _
10, "Scheduled Task", wshYesNoDialog + wshQuestionMark)

If intReturn = wshNo Then
Wscript.Quit
End If
 
Perfect, that is exactly what I was looking for. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top