• 0

[VB.NET] WMI to get DirectoryInfo


Question

Hi all,

I'm trying to use WMI in a VB .NET project to get information about files in a directory, specifically how many there are and the file sizes. The code to get the information is fairly standard but I cannot find a way to use WMI to authenticate to the domain and get the directory info using those credentials. I've hunted around for a way to do it but I can't seem to find anything.

Is anyone able to point me in the right direction at all?

Regardz :)

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

I'm assuming you are trying to access files and folders on a remote computer?

You could do this two ways, either through .NET's System.IO.* types, with a homegrown impersonation method (utilises pInvoked WINAPI calls), or if you are sure you want to use WMI, you should be able to authenticate with a remote computer using the following guide:

http://msdn.microsoft.com/en-us/library/aa389290(VS.85).aspx

Link to comment
Share on other sites

  • 0
I'm assuming you are trying to access files and folders on a remote computer?

You could do this two ways, either through .NET's System.IO.* types, with a homegrown impersonation method (utilises pInvoked WINAPI calls), or if you are sure you want to use WMI, you should be able to authenticate with a remote computer using the following guide:

http://msdn.microsoft.com/en-us/library/aa389290(VS.85).aspx

I've been looking further into it I've now been trying WNETUSECONNECT to connect to the remote machine and use DirectoryInfo from there.

Regardz :)

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.