I'm looking for VBScript code that will list the top level folders of the D: drive and not the subfolders. I use the following WMI query so far but it gives me all folders and goes down to many levels. Also seems to just stop for a reason I have not determined just yet.
Set colFolders = objWMIService.ExecQuery("Select * from Win32_Directory Where Drive = 'D:'")
EDIT:
After more searching I found something that gives me what I wanted. Just in case there are others looking here is the VBScript for folders and size:
Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
set objFolder = objFSO.GetFolder("D:\")
for Each folder in objFolder.SubFolders
On Error Resume Next
size = folder.size
if Err.Number <> 0 Then
size = -1
end if
wscript.echo folder.name,size
Next