C
cj
I found this code online and it works fine but I don't understand
exactly how and am trying to. Can someone help me?
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim t As Single
Dim WMIService, Computer As Object
WMIService =
GetObject("Winmgmts:{impersonationLevel=impersonate,(Debug,Shutdown)}")
For Each Computer In
WMIService.InstancesOf("Win32_OperatingSystem")
t = Computer.Win32Shutdown(8 + 4, 0)
If t <> 0 Then
MsgBox("Error")
End If
Next
End Sub
#1 GetObject requires a file name or a class. As winmgmts is not a
file on my computer I assume it is a class. How can I view it? I
understand the impersonationlevel but not the debug, shutdown.
#2 when it says for each computer in WMIService.InstancesOf
("Win32_OperatingSystem") what other things can I get to instead of
win32_operating sytem? Where or how can I find out my other options?
exactly how and am trying to. Can someone help me?
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim t As Single
Dim WMIService, Computer As Object
WMIService =
GetObject("Winmgmts:{impersonationLevel=impersonate,(Debug,Shutdown)}")
For Each Computer In
WMIService.InstancesOf("Win32_OperatingSystem")
t = Computer.Win32Shutdown(8 + 4, 0)
If t <> 0 Then
MsgBox("Error")
End If
Next
End Sub
#1 GetObject requires a file name or a class. As winmgmts is not a
file on my computer I assume it is a class. How can I view it? I
understand the impersonationlevel but not the debug, shutdown.
#2 when it says for each computer in WMIService.InstancesOf
("Win32_OperatingSystem") what other things can I get to instead of
win32_operating sytem? Where or how can I find out my other options?