Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I m working on this project where i pull information from a EDM file about the software installed on the machine. I can get the code to work on the local host but not on a remote computer. Please help...

When i try and run the code with a machine name i get the following error:

"Cannot Create ActiveX Component" I get this when i change the "." to a machine name in our network.

VB
objsh = CreateObject("WScript.Shell")

       strObject = "C:\Temp\ASERVICE.EDM"

       Dim process = GetObject("winmgmts://./root/novadigm:NVD_Agent")
       Dim method = process.Methods_("GetValue")
       Dim inParameters = method.inParameters.SpawnInstance_()
       inParameters.Path = strObject
       Dim outParameters = process.ExecMethod_("NumberOfInstances", inParameters)
       Dim StrHeaps = (outParameters.InstanceCount)
       num_TextBox.Text = StrHeaps
       For i = 0 To StrHeaps Step +1
           inParameters.Index = i

           inParameters.Property = "ZOBJNAME"
           outParameters = process.ExecMethod_("GetValue", inParameters)
           Dim Value1 As String = outParameters.Value

           inParameters.Property = "ZAVIS"
           outParameters = process.ExecMethod_("GetValue", inParameters)
           Dim Value2 As String = outParameters.Value

           inParameters.Property = "NAME"
           outParameters = process.ExecMethod_("GetValue", inParameters)
           Dim Value3 As String = outParameters.Value

           inParameters.Property = "INSTDATE"
           outParameters = process.ExecMethod_("GetValue", inParameters)
           Dim value5 As String = outParameters.Value

           Dim value4 = ListView1.Items.Count
           Dim item As New ListViewItem(value4)
           item.SubItems.Add(Value1)
           item.SubItems.Add(Value2)
           item.SubItems.Add(Value3)
           item.SubItems.Add(value5)
           ListView1.Items.Add(item)
           ListView1.FullRowSelect = True

           For Each item1 As ListViewItem In ListView1.Items
               If item1.Index Mod 2 = 0 Then
                   item1.BackColor = Color.LightBlue
               Else
                   item1.BackColor = Color.LightGray
               End If
           Next

       Next

   End Sub
Posted

1 solution

First, reverse the slashes in your GetObject statement. Network UNC paths use "\\" and "\", not "//" and "/".

Second, does the account that this code is running under (probably yours) have admin permissions to the remote machine?

Lastly, does the remote machine have a WMI namespace called "root\novadigm"??
 
Share this answer
 
Comments
Zachary.shupp 11-Feb-12 15:01pm    
yes the novadigm namespace is apart of the hp client automation that we use. I do have admn rights to the machine. Ii will try with the // and see what happens.
Dave Kreskowiak 11-Feb-12 15:43pm    
Even though the machine has the automation client, that does not mean that WMI hasn't been corrupted and the namespace missing. Use WBEMTEST to connect to the namespace on the remote machine and find out.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900