Jump to content

Recommended Posts

???

I am looking for a way to find out what the hard disk drive letters are on windows computers on the network.  I need to keep up with the hard drive free space on these machines which I can do with the "freediskspace()" function,  but I need to first find out how many drives the computers have - some have a C drive only, some have C and D, others have C E and F.  I need to know how to get the drive letters and make sure they are hard drives and not cdroms or mapped network drives.

 

I think vb script has something like "("Select * from Win32_LogicalDisk Where DriveType = " & HARD_DISK & "")" but I need to do it in php if at all possible.

 

Thanks in advance for any assistance.

Someone in the manual gave an example of how to list all drives, free space, total space and percentage free.  I suppose you can find out whether it's a cdrom drive or not by virtue of the numbers the code produces, but AFAIK there's no way to figure out whether it may be a mapped network drive or not.

Thanks for the replies broken and crayon....Im surprised I haven't seen this before.  I tried it and it looks like it will do the trick, I just need to get it to run through a list of machine hostnames.  I intend to run it as a cron job or scheduled task and generate text files, then just parse the text files with the web page, probably load the page quicker. I found a Pear package called WinDrives but it looks like it would have to be executed from a windows machine, still nice though.  I guess we can mark this as complete, thanks. 

 

Just curious - Why does this for loop use 65 to 90 ?

He's passing it through chr() which returns the character from the value that you pass to it.  I think 65-90 is like A-Z or something.

 

That's exactly right :)

 

Yeah, I knew what it was doing, but I was too lazy to actually count the numbers to see if it was actually the right amount of letters, lol.

Oh ok.... chr()

 

On the machines I have tested it on so far, mapped network drives do not show up which is fine, I don't want those.  I hope that's the way it's intended to work...

 

Mike

 

Earlier I told you that I didn't know if there was a way to tell if it was a mapped network drive or not, but I just read one of the notes for the link I gave earlier:

Note: This function will not work on remote files as the file to be examined must be accessible via the server's filesystem.

 

So yes, that is working as intended.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.