Space usage on a network share

  • I have a package I'm trying to put together that will cycle through various network shares (based on records pulled in from a table) and check each share to see it's drive usage statistics. I've found plenty of samples for doing this with the drives that are local to the server, but none that check network shares.

    From what I read, it looked like I might be able to establish an object of type Drive and then set it's path to the network share. Then I could use properties like AvailableSpace and TotalSize and such. However, I haven't been able to get this to work.

    Does anyone have a code snippet that does this sort of thing?

    Thanks in advance,

    Tim

  • I don't think it's an easy task (at least from how normal Windows don't show it easily unless you map the drive, and only TreeSize "Pro" version has this ability)

    Why not run a SQL query locally on each machine, and collect the output/results together

    SQLServerNewbie MCITP: Database Administrator SQL Server 2005
  • I believe the client here wants to test drive space on pretty much any share; not necessarily only on servers that have SQL running.

    Here's my current thought, though I haven't tested it and it's REALLY kludgy.

    Since I should be able to do this as a "drive" by mapping a local drive letter to the share, I'm thinking I could enumerate the table of shares and each time, shell out a NET USE command to map a specific drive letter. I'd just use the same letter each time so I wouldn't have to "reserve" more than one drive letter from the DBA's responsible for the server this is running on.

    Does this sound like a potentially feasible solution...albeit pretty cheezy.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply