Re: Shutdown help required
Posted: 09-20-2004, 08:12 PM
is a simple vbscript which shows general idea. Alternatively, a permanent
consumer can be created to eliminate the need for the vbscript. See
http://msdn.microsoft.com/library/en...asp?frame=true.
<vbscript>
if (wscript.arguments.count > 0) then
sComputer = wscript.arguments(0)
else
sComputer = "."
end if
set osvc = getobject("winmgmts:\\" & sComputer & "\root\cimv2")
set osink = wscript.createobject("wbemscripting.swbemsink","si nk_")
osvc.execnotificationqueryasync osink, "select * from
Win32_ComputerShutdownEvent"
while true
wscript.echo "waiting..."
wscript.sleep 1000
wend
sub sink_onobjectready(obj, ctx)
wscript.echo "Computer is shutting down."
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "notepad.exe"
end sub
</vbscript>
--
Philip Nunn [MSFT]
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.
"Selvin" <anonymous@discussions.microsoft.com> wrote in message
news:46bb01c49f0c$02a9c180$a601280a@phx.gbl...
> Hello,
>
> Can anyone help me with the task shown below:
>
> -: I would like to run a visual basic program when users
> shutdown windows.
>
> I would appreciate any information at any level.
> Suggestions can be detailed or an overview.
>
> Regards
>
> Selvin



Linear Mode

