K
kombu67
I'm writing a utility to shut down remote workstations. In order to
send a message to the user, I'd like to use the Win32ShutdownTracker
method. However, I receive this error message:
"This method is not implemented in any class."
Here's my code:
Try
Dim scope As New
Management.ManagementScope("\\RemoteServer\root\cimv2")
scope.Options.EnablePrivileges = True
scope.Connect()
Dim objQuery As New System.Management.ObjectQuery("SELECT *
FROM Win32_OperatingSystem")
Dim objSearcher As New
Management.ManagementObjectSearcher(scope, objQuery)
Dim objCol As Management.ManagementObjectCollection =
objSearcher.Get()
Dim mo As Management.ManagementObject
For Each mo In objCol
Dim methodArgs As String() = {"10", "Testing...", "1", "6"}
mo.InvokeMethod("Win32ShutdownTracker", methodArgs) ' Error
occurrs here
Console.WriteLine(mo.ToString())
Next
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical)
End Try
I assume that the problem lies in methodArgs, but can't figure out what
it might be. The Win32Shutdown method works without a problem (in that
case, methodArgs = {"6", "0"}).
Thanks in advance!
Kombu
send a message to the user, I'd like to use the Win32ShutdownTracker
method. However, I receive this error message:
"This method is not implemented in any class."
Here's my code:
Try
Dim scope As New
Management.ManagementScope("\\RemoteServer\root\cimv2")
scope.Options.EnablePrivileges = True
scope.Connect()
Dim objQuery As New System.Management.ObjectQuery("SELECT *
FROM Win32_OperatingSystem")
Dim objSearcher As New
Management.ManagementObjectSearcher(scope, objQuery)
Dim objCol As Management.ManagementObjectCollection =
objSearcher.Get()
Dim mo As Management.ManagementObject
For Each mo In objCol
Dim methodArgs As String() = {"10", "Testing...", "1", "6"}
mo.InvokeMethod("Win32ShutdownTracker", methodArgs) ' Error
occurrs here
Console.WriteLine(mo.ToString())
Next
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical)
End Try
I assume that the problem lies in methodArgs, but can't figure out what
it might be. The Win32Shutdown method works without a problem (in that
case, methodArgs = {"6", "0"}).
Thanks in advance!
Kombu