vb.net processus BasenamedObjects
bonjour,
j'ai fais un code en vb;net pour recuperer les processus tournant sur une machine distante que voici:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| Try
Dim pc As String = "10.11.12.13"
Dim connection As New ConnectionOptions 'Pour spécifier le nom d'utilisateur,password
'string domain = "yourdomain"
connection.Username = "user"
connection.Password = "Lecode"
Dim scope As New ManagementScope
scope = New ManagementScope("\\" & pc & "\root\CIMV2", connection)
scope.Connect()
Dim query As New ObjectQuery("SELECT * FROM Win32_Process")
Dim searcher As New ManagementObjectSearcher(scope, query)
Dim queryObj As ManagementObject
For Each queryObj In searcher.Get()
'MsgBox(queryObj.ToString)
MsgBox(queryObj("Name").ToString & vbCrLf & queryObj("WriteTransferCount").ToString)
'MsgBox(queryObj("ProcessId").ToString & vbCrLf & queryObj("Name").ToString & vbCrLf & queryObj("handle").ToString)
Next
Catch err As ManagementException
MsgBox("An error occurred while querying for WMI data: " & err.Message)
Catch unauthorizedErr As System.UnauthorizedAccessException
MsgBox("Connection error (user name or password might be incorrect): " & unauthorizedErr.Message)
End Try |
je voudrais recuperer le BaseNamedObjects comme le fait process explorer, je retrouve bien ID le name... mais pas BaseNamedObjects
Si vous avez une idées Merci
Cordialement