I don't know about how to use this with the network, but this is the code for how to shutdown/restart or suspend:


Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
Private Declare Function SetSystemPowerState Lib "kernel32" (ByVal fSuspend As Long, ByVal fForce As Long) As Long
Enum exitmode
Shutdown = 0
Restart = 1
Suspend = 2
End Enum

Sub ExitWindows(how As exitmode)
Select Case how
Case 0
t& = ExitWindowsEx(1, 0)
Case 1
t& = ExitWindowsEx(2 Or 4, 0)
Case 2
SetSystemPowerState 1, 1
Case Else
MsgBox "Invalid exitmode calling ExitWindows... Try to use your brain or VB!"
End Select
End Sub