Shutdown computers op netwerk

Status
Niet open voor verdere reacties.

xl3igplayer

Gebruiker
Lid geworden
22 jan 2011
Berichten
143
hallo,

als je bij cmd.exe invoert
Code:
"shutdown -i"

krijg je een menu waar je een computer toevoegt een computer kan uitzetten ( shutdown )

maar ik wil graag dat ik dat in vb kan doen,

ik heb al zoiets gezien het engiste wat ik weet was dat er stond

Code:
hierwat("computernaam",shutdown,30,true,true)

maar ik kan het nergens meer vinden ... ik hoop dat iemand mij kan helpen

snap je me vraag niet helemaal dan wil ik het wel ff wat beter uitleggen maar ik denk dat jullie het zo wel begrijpen !

Edit:

ik heb de code gevonden

Code:
Option Explicit

Public 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 Declare Function AbortSystemShutdown Lib "advapi32.dll" Alias "AbortSystemShutdownA" (ByVal lpMachineName As String) As Long



Private Sub Command1_Click()
    
    InitiateSystemShutdown "\\MYPC", "The system is Shutting Down", 30, True, True
End Sub

Private Sub Command2_Click()
    
    AbortSystemShutdown "\\MYPC"
End Sub



maar ik krijg nu de error van MDA's ofzo

ik kopieer de error ff


PInvokeStackImbalance was detected
Message: A call to PInvoke function 'shutdown!shutdown.Form1::InitiateSystemShutdown' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
 
Laatst bewerkt:
Is dit voor je computer gewoon uit te schakelen of kan het ook bij andere computers die gebonden zijn in hetzelfde netwerk?
 
Probeer dit eens, misschien werkt het, misschien ook niet. Je voert CMD uit met een parameter (in dit geval 'shutdown -i'), da's alles =)

PHP:
Process.Start("cmd.exe", "/C shutdown -i")
Of
PHP:
Process.Start("cmd.exe", "shutdown -i")
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan