Hello
I'm trying to create a vbs plugin to read WMI class Win32_ShadowCopy.
My script work OK when launched by an (admin) cmd, but I can get no answer when launched by OCS Agent (Win 7 x64 FR).
Here's my debug version, that basically dumps all info in a text file in c:\temp\.
Again, this version works OK when launched from anywhere, including from the Plugins directory, directly by an administrator prompt. When launched by OCS, however, the debug file ends after f.writeline(TypeName(colItems)) :
'On Error Resume Next
Dim strComputer
Dim fso
Set fso = WScript.CreateObject("Scripting.Filesystemobject")
Set f = fso.CreateTextFile("C:\temp\dbg2output.txt", 2)
strComputer = "."
Set objCtx = CreateObject("WbemScripting.SWbemNamedValueSet")
objCtx.Add "_ProviderArchitecture", 64
Set objLocator = CreateObject("Wbemscripting.SWbemLocator")
Set objServices = objLocator.ConnectServer(strComputer,"root\cimv2","","",,,,objCtx)
f.writeline("Locator is Set")
Set colItems = objServices.ExecQuery("Select * from Win32_ShadowCopy")
f.writeline("ExecQuery done")
f.writeline(TypeName(colItems))
f.writeline(colItems.Count)
For Each objItem in colItems
f.writeline("Looping over colItem")
For Each oProp in objItem.Properties_
'Dump all object properties
f.WriteLine(oProp.Name & " : " & oProp)
Next
Next
f.writeline("Leaving script now")
f.Close
I think the problem is specific to Win32_Shadow*, considering that if you replace Win32_ShadowCopy with, say, Win32_Volume, everything works OK.
I thought Win32_ShadowCopy was a 64b only accessible class, but as you can see I used ProviderArchitecture to ensure I'm querying the 64b CIMV2 Namesace, to no avail.
Any help would be very much appreciated on this one :)
Regards,
Pierre.
I'm trying to create a vbs plugin to read WMI class Win32_ShadowCopy.
My script work OK when launched by an (admin) cmd, but I can get no answer when launched by OCS Agent (Win 7 x64 FR).
Here's my debug version, that basically dumps all info in a text file in c:\temp\.
Again, this version works OK when launched from anywhere, including from the Plugins directory, directly by an administrator prompt. When launched by OCS, however, the debug file ends after f.writeline(TypeName(colItems)) :
'On Error Resume Next
Dim strComputer
Dim fso
Set fso = WScript.CreateObject("Scripting.Filesystemobject")
Set f = fso.CreateTextFile("C:\temp\dbg2output.txt", 2)
strComputer = "."
Set objCtx = CreateObject("WbemScripting.SWbemNamedValueSet")
objCtx.Add "_ProviderArchitecture", 64
Set objLocator = CreateObject("Wbemscripting.SWbemLocator")
Set objServices = objLocator.ConnectServer(strComputer,"root\cimv2","","",,,,objCtx)
f.writeline("Locator is Set")
Set colItems = objServices.ExecQuery("Select * from Win32_ShadowCopy")
f.writeline("ExecQuery done")
f.writeline(TypeName(colItems))
f.writeline(colItems.Count)
For Each objItem in colItems
f.writeline("Looping over colItem")
For Each oProp in objItem.Properties_
'Dump all object properties
f.WriteLine(oProp.Name & " : " & oProp)
Next
Next
f.writeline("Leaving script now")
f.Close
I think the problem is specific to Win32_Shadow*, considering that if you replace Win32_ShadowCopy with, say, Win32_Volume, everything works OK.
I thought Win32_ShadowCopy was a 64b only accessible class, but as you can see I used ProviderArchitecture to ensure I'm querying the 64b CIMV2 Namesace, to no avail.
Any help would be very much appreciated on this one :)
Regards,
Pierre.