Hoping that someone can help me out with this.
Here is what I got.
I have a mapped network Drive called J: and I need to list all of the subfolders and their child subfolders for the J drive and dump that into an array.
I can list all of the subfolders of the root drive but not the child subfolder for the subfolders.
Here's the code that I have that lists the subfolders but not their child subfolders
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSubfolders = objWMIService.ExecQuery _
("Associators of {Win32_Directory.Name='j:\'} " _
& "Where AssocClass = Win32_Subdirectory " _
& "ResultRole = PartComponent")
For Each objFolder in colSubfolders
Wscript.Echo objFolder.Name
Next
Does someone know of another way to do this or will I have to do a for each loop to get the child folders???
ThanX
Here is what I got.
I have a mapped network Drive called J: and I need to list all of the subfolders and their child subfolders for the J drive and dump that into an array.
I can list all of the subfolders of the root drive but not the child subfolder for the subfolders.
Here's the code that I have that lists the subfolders but not their child subfolders
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSubfolders = objWMIService.ExecQuery _
("Associators of {Win32_Directory.Name='j:\'} " _
& "Where AssocClass = Win32_Subdirectory " _
& "ResultRole = PartComponent")
For Each objFolder in colSubfolders
Wscript.Echo objFolder.Name
Next
Does someone know of another way to do this or will I have to do a for each loop to get the child folders???
ThanX