WMI和vb.net的帮助 [英] Help with WMI and vb.net
本文介绍了WMI和vb.net的帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在从事这个项目,我从EDM文件中提取有关机器上安装的软件的信息.我可以使代码在本地主机上工作,但不能在远程计算机上工作.请帮忙...
当我尝试使用机器名称运行代码时,出现以下错误:
无法创建ActiveX组件",当我更改时"会收到此消息.更改为我们网络中的计算机名称.
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.
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
推荐答案
首先,在您的GetObject语句中反斜杠.网络UNC路径使用"\\"和"\",而不是"//"和"/".
其次,运行此代码的帐户(可能是您的帐户)是否具有对远程计算机的管理员权限?
最后,远程机器是否有一个名为"root \ novadigm"的WMI名称空间?
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"??
这篇关于WMI和vb.net的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文