Link to home
Start Free TrialLog in
Avatar of Consti
Consti

asked on

Win2000---How to shut down over VB script

I want to make a programm in VB 6 which shuts down or logs off a Win2000 System immediately.
And if i say immediatley i mean it!
No "last pop up" or "do-u-really-want-to-...?" alerts!
I need the source for such a programm.
Thx
Consti
Avatar of beckingh
beckingh

Here you go... just paste this into a module and call the subroutine Shutdown  Make sure the computer name is in the syntax of \\computername


Private Declare Function InitiateSystemShutdown Lib "advapi32.dll" Alias "InitiateSystemShutdownA" (ByVal lpMachineName As String, ByVal lpMessage As String, ByVal dwTimeout As Long, ByVal bForceAppsClosed As Long, ByVal bRebootAfterShutdown As Long) As Long

Public Sub Shutdown(strComputerName As String)
  'Send ShutDown Command
  Dim lError As Long
  lError = InitiateSystemShutdown(strComputerName, "", &0, True, False)

End Sub
ASKER CERTIFIED SOLUTION
Avatar of glass_cookie
glass_cookie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Consti,

Every question you have ever asked is still open. Please resolve them appropriately as soon as possible. Continued disregard of your open questions will result in the force/acceptance of a comment as an answer; other actions affecting your account may also be taken. I will revisit these questions in approximately seven (7) days.

https://www.experts-exchange.com/jsp/qShow.jsp?qid=20169897
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20166962
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20129060
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20128938
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20123540
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20123014
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20105425
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20106785

Thanks,

Netminder
Community Support Moderator
Experts Exchange
Hi!

How's your question going?

That's it!

glass cookie : )
Avatar of Consti

ASKER

Sorry... :-)