Does anyone know how to call Win32Shutdown method of Win32_OperatingSystem class.
Here is what I have got so far:
VB Code:
Dim OSClass As New ManagementClass("Win32_OperatingSystem") ' Get an input parameters object for this method Dim inParams As ManagementBaseObject = processClass.GetMethodParameters("Win32Shutdown") ' Fill in input parameter values inParams("Flags") = 2 ' Execute the method Dim outParams As ManagementBaseObject = processClass.InvokeMethod("Win32Shutdown", inParams, Nothing)
I got an error 'invalid method Parameter(s)' when it reached the last line InvokeMethod. What I want to do is just to shutdown the machine using VB.NET.




Reply With Quote