put a Logoff Icon on desktop

G

Guest

I would like to put a logoff icon on the desktop of the lab computers at our
university. I know how to do it with tweakxp pro, and I know how to do it
with the shutdown command. What I would like to do, is to put an icon on the
desktop that works just like the logoff command on the startmenu, one that
shows the username as well. Can anyone help me with this?

Thank you!
 
H

Homer J. Simpson

esabotta said:
I would like to put a logoff icon on the desktop of the lab computers at
our
university. I know how to do it with tweakxp pro, and I know how to do it
with the shutdown command. What I would like to do, is to put an icon on
the
desktop that works just like the logoff command on the startmenu, one that
shows the username as well. Can anyone help me with this?

Thank you!

I haven't tried it, but going by the help brought up by "shutdown /?", a
shortcut to "shutdown -l" ought to do it...
 
G

Guest

That's what I've got right now, but it dosent bring up a confirm dialogue box
nore does it put the users name on the desktop like in the startmenu.
 
H

Homer J. Simpson

That's what I've got right now, but it dosent bring up a confirm dialogue

Well then you'll have to do a little coding yourself. You should be able to
have your shortcut call wscript or cscript to execute some code similar to
the following (untested):

var oShell = new ActiveXObject( "WScript.Shell" );
if( 1 == oShell.Popup( "Are you sure you wish to logoff?", 0, "Please
confirm...", 33 ) )
oShell.run( "shutdown -l" );
nore does it put the users name on the desktop like in the startmenu.

The above script will log off the current user after confirmation, whoever
it is, and not anybody else...if you really need to know who the current
user is before deciding to log off, look at the Start menu, just like you
have to do right now...

I suppose you could have the script above fetch the current user name (or
evaluate %USERNAME%) and display it as part of the confirmation dialog box.
I don't know the exact details off the top of my head, but I know they've
been posted in microsoft.public.scripting.wsh before.
 
P

Paul

esabotta said:
I would like to put a logoff icon on the desktop of the lab computers at
our
university. I know how to do it with tweakxp pro, and I know how to do it
with the shutdown command. What I would like to do, is to put an icon on
the
desktop that works just like the logoff command on the startmenu, one that
shows the username as well. Can anyone help me with this?

Thank you!

Put this on your desktop
 
K

Klaus Jorgensen

esabotta said:
I would like to put a logoff icon on the desktop of the lab computers
at our
university. I know how to do it with tweakxp pro, and I know how to
do it
with the shutdown command. What I would like to do, is to put an
icon on the
desktop that works just like the logoff command on the startmenu,
one that
shows the username as well. Can anyone help me with this?

----logoff.vbs-------------------
Option Explicit
On Error Resume Next

Dim WshShell
Dim logoffStr,yesnoButton
Set WshShell=Wscript.CreateObject("Wscript.Shell")
logoffStr = "Log off user """ &
WshShell.ExpandEnvironmentStrings("%USERNAME%") & """ ?"
yesnoButton = WSHShell.Popup(logoffStr,,"Log off Windows",52)
select case yesnoButton
case 6
WSHShell.Run "shutdown -l"
end select

Set WSHShell = Nothing
-------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top