Getting used space for a remote UNC path

I am developing a small part of an application that should be able to determine how much space a folder is taking up on a remote server. I found a post in the GetDiskFreeSpaceEx function and it works like a charm for my mapped drives. But when I supply UNC path \ server \ share \ folder \ it fails with 1326 win32 error.

This, I see, has to do with credentials. The funny thing is that if I open the UNC path either through the promp command or through the explorer, I can see the files and see how much space they take up. What am I missing? I saw a post where someone needed to run the code as administrator for it to work. But surely there must be another way?



source to share

All Articles