Hello everybody,
I need to know if a remote folder exist but not with UNC notation but with WMI
Here my code :
I have a list of folder which represents my users and inside some of this folder I have the folder TOTO.
And I want to know the toto size (with a recursive function) but it crashes on this :
for each mbx in listeMbx
mbx=mbx+"\Archives"
wscript.echo mbx
redim listeArchives(0) : listeArchives(0)=mbx
build_mbxTree mbx,svc,listeArchives
next
sub build_mbxTree(sroot, wmisvc, listeArchives)
sQuery="Associators of {Win32_directory.name='" & sroot & "'} " & _
"where AssocClass=win32_subdirectory " & _
"ResultRole=PartComponent"
'wscript.echo sQuery
set cfolder=wmisvc.execquery(sQuery)
wscript.echo cfolder.count
'wscript.echo "total = " + cstr(cfolder.count)
for each ofolder in cfolder
wscript.echo ofolder.name
i=ubound(listeArchives)+1
redim preserve listeArchives(i)
listeArchives(i-1)=ofolder.name 'consistently in unescaped string format
wscript.echo i,ofolder.name
next
redim preserve listeArchives(i-1)
for each ofolder in cfolder
build_mbxtree ofolder.name, wmisvc, afolder
next
end sub
It crashes at :
wscript.echo cfolder.count
'wscript.echo "total = " + cstr(cfolder.count)
for each ofolder in cfolder
With
C:\exploit\scripts\dir3.vbs(45, 2) SWbemObjectSet: Not found
Thanks for your help...
I need to know if a remote folder exist but not with UNC notation but with WMI
Here my code :
I have a list of folder which represents my users and inside some of this folder I have the folder TOTO.
And I want to know the toto size (with a recursive function) but it crashes on this :
for each mbx in listeMbx
mbx=mbx+"\Archives"
wscript.echo mbx
redim listeArchives(0) : listeArchives(0)=mbx
build_mbxTree mbx,svc,listeArchives
next
sub build_mbxTree(sroot, wmisvc, listeArchives)
sQuery="Associators of {Win32_directory.name='" & sroot & "'} " & _
"where AssocClass=win32_subdirectory " & _
"ResultRole=PartComponent"
'wscript.echo sQuery
set cfolder=wmisvc.execquery(sQuery)
wscript.echo cfolder.count
'wscript.echo "total = " + cstr(cfolder.count)
for each ofolder in cfolder
wscript.echo ofolder.name
i=ubound(listeArchives)+1
redim preserve listeArchives(i)
listeArchives(i-1)=ofolder.name 'consistently in unescaped string format
wscript.echo i,ofolder.name
next
redim preserve listeArchives(i-1)
for each ofolder in cfolder
build_mbxtree ofolder.name, wmisvc, afolder
next
end sub
It crashes at :
wscript.echo cfolder.count
'wscript.echo "total = " + cstr(cfolder.count)
for each ofolder in cfolder
With
C:\exploit\scripts\dir3.vbs(45, 2) SWbemObjectSet: Not found
Thanks for your help...