W
William Cruz
Can anyone help me with this piece of code. - I keep on getting the
error message "The object exporter specified was not found"
If i change it to run on my local machine it works fine, the problem
occurs when trying to connect to a remote pc.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Try
Dim connection As New ConnectionOptions
connection.Username = "the user name"
connection.Password = "the password"
connection.Authority = "ntlmdomain:the domain name"
Dim scope As New ManagementScope("\\the ip
address\root\CIMV2", connection)
scope.Connect()
Dim query As New ObjectQuery( _
"SELECT * FROM Win32_UTCTime")
Dim searcher As New ManagementObjectSearcher(scope, query)
For Each queryObj As ManagementObject In searcher.Get()
Console.WriteLine("-----------------------------------")
Console.WriteLine("Win32_UTCTime instance")
Console.WriteLine("-----------------------------------")
Console.WriteLine("DayOfWeek: {0}",
queryObj("DayOfWeek"))
Next
Close()
Catch err As ManagementException
MessageBox.Show("An error occurred while querying for WMI
data: " & err.Message)
Catch unauthorizedErr As System.UnauthorizedAccessException
MessageBox.Show("Connection error (user name or password
might be incorrect): " & unauthorizedErr.Message)
End Try
End Sub
William Cruz
error message "The object exporter specified was not found"
If i change it to run on my local machine it works fine, the problem
occurs when trying to connect to a remote pc.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Try
Dim connection As New ConnectionOptions
connection.Username = "the user name"
connection.Password = "the password"
connection.Authority = "ntlmdomain:the domain name"
Dim scope As New ManagementScope("\\the ip
address\root\CIMV2", connection)
scope.Connect()
Dim query As New ObjectQuery( _
"SELECT * FROM Win32_UTCTime")
Dim searcher As New ManagementObjectSearcher(scope, query)
For Each queryObj As ManagementObject In searcher.Get()
Console.WriteLine("-----------------------------------")
Console.WriteLine("Win32_UTCTime instance")
Console.WriteLine("-----------------------------------")
Console.WriteLine("DayOfWeek: {0}",
queryObj("DayOfWeek"))
Next
Close()
Catch err As ManagementException
MessageBox.Show("An error occurred while querying for WMI
data: " & err.Message)
Catch unauthorizedErr As System.UnauthorizedAccessException
MessageBox.Show("Connection error (user name or password
might be incorrect): " & unauthorizedErr.Message)
End Try
End Sub
William Cruz