Welcome to OCS Inventory NG community support, where you can ask questions and receive answers from other members of the community.

Please ask questions only in English or French.

Release 2.11.1 available

The official documentation can be found on http://wiki.ocsinventory-ng.org. Read it before asking your question.

vbs plugin - WMI Win32_ShadowCopy not readable / non lisible ?

(Version francaise en dessous)


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")


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)
f.writeline("Leaving script now")

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 :)

=============== FR_f r==============


En utilisnt le code ci-dessus, lancé depuis un cmd Administrateur, je retrouve bien la liste des clichés VSS existants. Mais, quand il est lancé par OCS (service, donc compte Système Local, que j'aimerais bien ne pas modifier), rien sauf un message d'erreur.

En remplaceant Win32_ShadowCopy par Win32_Volumes, et avec un lancement par OCS toujours, je récupère bien la liste des volumes, donc tout le reste du scipt ne pose pas de problème.

Quelqu'un connaitrait une manip spéciale, un token a obtenir, un paramètre à passer, pour pouvoir interroger Win32_ShadowCopy via un plugin OCS ?


in External plugins by (120 points)
edited by

Please log in or register to answer this question.

Powered by Question2Answer