|
-
May 2nd, 2005, 03:30 PM
#1
Thread Starter
Addicted Member
Using WMI to list all subfolders of a folder
Hey,
I am trying to use WMI to list all the folders inside a folder remotely on a machien on our network here. I have some code but it uses the FileSystemObject and it dosen't work remotely.
Anyone know how I can procede to fix this problem and move on to some more code?
Here is the code that uses the File System Object.
Code:
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\FSO")
Set colSubfolders = objFolder.Subfolders
For Each objSubfolder in colSubfolders
Wscript.Echo objSubfolder.Name, objSubfolder.Size
Next
-
May 2nd, 2005, 03:44 PM
#2
Re: Using WMI to list all subfolders of a folder
I dont believe that FSO can get remote information.
This is some VB6 code I have that can get remote information. Its not the file system but may help you on your way. 
VB Code:
Private Sub Command1_Click()
'Add a reference to WMI
Dim System As Object
Set System = GetObject("winmgmts:{impersonationLevel=impersonate}!//MyOtherSystem/root/cimv2:Win32_ComputerSystem=""MyOtherSystem""")
MsgBox System.Caption
MsgBox System.PrimaryOwnerName
MsgBox System.Domain
MsgBox System.SystemType
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 2nd, 2005, 04:03 PM
#3
Re: Using WMI to list all subfolders of a folder
Try these classes of WMI for getting filesystem info. Also, I added one for Ping since I saw your other thread. 
Win32_PingStatus
CIM_DirectorySpecificationFile
CIM_ToDirectorySpecification
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 3rd, 2005, 08:05 AM
#4
Thread Starter
Addicted Member
Re: Using WMI to list all subfolders of a folder
I'll look into those classes and see if they can get me the information I need. I'll update this thread when I know more information.
Thanks Robo
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|