VBS WMI查询被困 [英] VBS WMI Query Stuck

查看:62
本文介绍了VBS WMI查询被困的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在向远程计算机运行VBS WMI查询,它返回我想要的内容,excel.exe文件版本,如果它是14.x,但不是它是15.x.  我对两个版本使用完全相同的语法,只改变了路径,并且可以在很多机器上重现问题(和
成功)。


这里是代码段...


<预类= "prettyprint"> strOFFICE15is32 = QUOT; C:\\program文件(86)\\microsoft office\\office15\\\ \\excel.exe"
如果objFSO.FileExists(strOFFICE15is32)然后
'
组objWMIService = GetObject的(" winmgmts:" _
&安培;" {impersonationLevel =冒充} \\\ \\"&放;主机名和放大器;" \root\cimv2")
组colComputer = objWMIService.ExecQuery _
(" SELECT * FROM CIM_Datafile其中Name ='"&安培; strOFFICE15is32和放大器;"'")
。对于(每objComputer在colComputer
objExcel.Cells intRow,7)。价值=用Ucase(objComputer.Version)
下一
结束如果

我甚至可以在每个版本的示例中导航到WMI数据并查看两者的数据。



那为什么我不能获取15.x文件版本的数据?   


...或者,是否有其他可以使用的查询可能有效?

解决方案

< blockquote>

对不起,你的问题是什么?


我需要Excel的帮助,那么你应该在其中一个Excel论坛上发帖。


如果您正在尝试询问如何使用VBScript,那么您需要提出一个明确的问题。 你发布的内容非常不清楚。


I am running VBS WMI query to remote machines and it returns what I want, the excel.exe file version, if it is 14.x, but not if it's 15.x.  I use the exact same syntax for both versions with just the path changed, and can reproduce the problem, (and the success), on lots of machines.

Here's the snippet...

strOFFICE15is32 = "c:\\program files (x86)\\microsoft office\\office15\\excel.exe"
If objFSO.FileExists(strOFFICE15is32) Then
'
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & HostName & "\root\cimv2") 
Set colComputer = objWMIService.ExecQuery _
    ("Select * from CIM_Datafile where Name='" & strOFFICE15is32 & "'")
 For Each objComputer in colComputer
objExcel.Cells(intRow, 7).Value = UCase(objComputer.Version)
Next
End If

I can even navigate to the WMI data on examples of each version and see the data on both.

So why can't I get the data for 15.x file version?   

...or, is there another query I could use that might work?

解决方案

I am sorry but what is your question?

I you need help with Excel then you should post in one of the Excel forums.

If you are trying to ask how to use VBScript then you need to ask a clear question.  What you have posted is very unclear.


这篇关于VBS WMI查询被困的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆