PROBLEMAS COM WMI
Pessoal tenho o código abaixo que executa uma chamada WMI em uma estação, mas ele está com loop infinito a impressão que tenho que ele não está pulando para o próximo evento, alguém poderia dar uma olhada por favor.
Obrigado.
CÓDIGO:
Dim strTargetServer As String = [Ô]SERVIDOR1[Ô]
Dim colAuditIDs As New Collection
colAuditIDs.Add(560)
[ô]Set the WMI scope options
Dim oWMI_Scope As New ManagementScope
oWMI_Scope.Path.Server = strTargetServer
oWMI_Scope.Path.Path = [Ô]\\[Ô] & strTargetServer & [Ô]oot\CIMV2[Ô]
oWMI_Scope.Path.NamespacePath = [Ô]root\CIMV2[Ô]
oWMI_Scope.Options.Authentication = AuthenticationLevel.Default
oWMI_Scope.Options.Impersonation = ImpersonationLevel.Impersonate
oWMI_Scope.Options.EnablePrivileges = True
[ô]Define the WMI query
Dim oWMI_Query As New ObjectQuery
oWMI_Query.QueryString = [Ô]SELECT * FROM Win32_NTLogEvent WHERE Logfile = [ô]SECURITY[ô] AND EventCode = [ô]560[ô][Ô]
[ô]Create the WMI search engine
Dim oWMI_Results As New ManagementObjectSearcher(oWMI_Scope, oWMI_Query)
Dim oWMI_Property As PropertyData
Dim oWMI_Object As Object
For Each oWMI_Object In oWMI_Results.Get()
[ô] print out each name/value pair
For Each oWMI_Property In oWMI_Object.Properties
MsgBox(oWMI_Object([Ô]Message[Ô]))
[ô]MsgBox(vbNewLine & oWMI_Property.Name & [Ô]=[Ô] & Convert.ToString(oWMI_Property.Value))
Next
Next oWMI_Object
FONTE:
http://www.windowsitpro.com/forums/aft/31740
Obrigado.
CÓDIGO:
Dim strTargetServer As String = [Ô]SERVIDOR1[Ô]
Dim colAuditIDs As New Collection
colAuditIDs.Add(560)
[ô]Set the WMI scope options
Dim oWMI_Scope As New ManagementScope
oWMI_Scope.Path.Server = strTargetServer
oWMI_Scope.Path.Path = [Ô]\\[Ô] & strTargetServer & [Ô]oot\CIMV2[Ô]
oWMI_Scope.Path.NamespacePath = [Ô]root\CIMV2[Ô]
oWMI_Scope.Options.Authentication = AuthenticationLevel.Default
oWMI_Scope.Options.Impersonation = ImpersonationLevel.Impersonate
oWMI_Scope.Options.EnablePrivileges = True
[ô]Define the WMI query
Dim oWMI_Query As New ObjectQuery
oWMI_Query.QueryString = [Ô]SELECT * FROM Win32_NTLogEvent WHERE Logfile = [ô]SECURITY[ô] AND EventCode = [ô]560[ô][Ô]
[ô]Create the WMI search engine
Dim oWMI_Results As New ManagementObjectSearcher(oWMI_Scope, oWMI_Query)
Dim oWMI_Property As PropertyData
Dim oWMI_Object As Object
For Each oWMI_Object In oWMI_Results.Get()
[ô] print out each name/value pair
For Each oWMI_Property In oWMI_Object.Properties
MsgBox(oWMI_Object([Ô]Message[Ô]))
[ô]MsgBox(vbNewLine & oWMI_Property.Name & [Ô]=[Ô] & Convert.ToString(oWMI_Property.Value))
Next
Next oWMI_Object
FONTE:
http://www.windowsitpro.com/forums/aft/31740
Alguém ????
Já colocasse um breakpoint e visse onde o código está retornando?
Sim, mas ele fica no looping esse é o problema.
Tópico encerrado , respostas não são mais permitidas