Go Back   TechArena Community > Technical Support > Computer Help > Windows Server > Windows Server Help
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Free disk space from volume mount point.

Windows Server Help


Reply
 
Thread Tools Search this Thread
  #1  
Old 18-03-2008
Albert Kikkert
 
Posts: n/a
Free disk space from volume mount point.

Hello,

My assignment is to create a script that will get report all disks, sizes
and free space from all our domain member servers.
Now I'm trying to find a way to get the free (or used) disk space
information in a volume mount point disk

I have the script ready and it's working like a charm. The only thing it
doesn't do is report the disks who do not have a drive letter assigned but
are mounted inside another disk instead.

We have a lot of servers who have their volumes mounted and I can't use a
3rd party app.
The only thing I can find for mountpoints is a default example app which I
modified to just report the volume mount points and not ALL disks drives.
Unfortunately "Win32_MountPoint" does not support the property "FreeSpace"

This is all i have for now:

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery _
("SELECT * FROM Win32_MountPoint")
For Each objItem In colItems
DirL =
Mid(objItem.Directory,Instr(objItem.Directory,"=")+1,len(objItem.Directory))
If len(DirL) > 6 then
WScript.Echo "Directory: " & objItem.Directory
WScript.Echo "Volume: " & objItem.Volume
end if
Next

Thanks in advance,

Albert.



Reply With Quote
  #2  
Old 18-03-2008
Albert Kikkert
 
Posts: n/a
Re: Free disk space from volume mount point.

Never mind I found it myself.

For anyone who likes to know how, I used Win32_Volume instead of
Win32_LogicalDisk.

Here's a code snipet:

Set objDISKWMIService = GetObject _
("winmgmts:\\" & strComputer & "\root\cimv2")
Set colDiskItems = objDISKWMIService.ExecQuery _
("Select * from Win32_Volume")

For Each objDiskItem in colDiskItems
if objDiskItem.DriveType = 3 then

strDiskSize = round(objDiskItem.Capacity /1073741824,3)

strDisk = strDisk & vbCr & _
"Drive Letter: " & objDiskItem.Name & vbCr & _
"Device ID : " & objDiskItem.DeviceID & vbCr & _
"Disk Size : " & strDiskSize & vbCr & "Free Space : " _
& Int(objDiskItem.FreeSpace /1048576) & " MB" & vbCr & _
" ========================="

If LogPositivesOnly then
If strDiskSize > 0 then MyFile.WriteLine StrComputer & ";" &
objDiskItem.Name & ";" & objDiskItem.Label & ";" & strDiskSize & ";" &
round(objDiskItem.FreeSpace/1073741824,3) & ";" & objDiskItem.FileSystem &
";" & objDiskItem.DriveType

Else
MyFile.WriteLine StrComputer & ";" &
objDiskItem.Name & ";" & objDiskItem.Label & ";" & strDiskSize & ";" &
round(objDiskItem.FreeSpace/1073741824,3) & ";" & objDiskItem.FileSystem &
";" & objDiskItem.DriveType
End if
end if

thanks for looking.

Albert.


"Albert Kikkert" <a.kikkert@gmail.com> wrote in message
news:%23fsXq0PiIHA.4684@TK2MSFTNGP06.phx.gbl...
> Hello,
>
> My assignment is to create a script that will get report all disks, sizes
> and free space from all our domain member servers.
> Now I'm trying to find a way to get the free (or used) disk space
> information in a volume mount point disk
>
> I have the script ready and it's working like a charm. The only thing it
> doesn't do is report the disks who do not have a drive letter assigned but
> are mounted inside another disk instead.
>
> We have a lot of servers who have their volumes mounted and I can't use a
> 3rd party app.
> The only thing I can find for mountpoints is a default example app which I
> modified to just report the volume mount points and not ALL disks drives.
> Unfortunately "Win32_MountPoint" does not support the property "FreeSpace"
>
> This is all i have for now:
>
> strComputer = "."
> Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
> Set colItems = objWMIService.ExecQuery _
> ("SELECT * FROM Win32_MountPoint")
> For Each objItem In colItems
> DirL =
> Mid(objItem.Directory,Instr(objItem.Directory,"=")+1,len(objItem.Directory))
> If len(DirL) > 6 then
> WScript.Echo "Directory: " & objItem.Directory
> WScript.Echo "Volume: " & objItem.Volume
> end if
> Next
>
> Thanks in advance,
>
> Albert.
>



Reply With Quote
Reply

  TechArena Community > Technical Support > Computer Help > Windows Server > Windows Server Help
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Free disk space from volume mount point."
Thread Thread Starter Forum Replies Last Post
Local Disk Q: shows Free Space- 0 bytes, Total Space- 0 bytes and Access Denied message mADiRAkSHii Hardware Peripherals 5 30-01-2012 05:42 PM
There is not enough free disk space to run Steam Ameeryan Video Games 3 28-08-2009 11:31 PM
Free up disk space. halutz Operating Systems 3 01-11-2008 12:25 PM
How to free up disk space? Bhairav Hardware Peripherals 2 30-07-2008 03:31 PM
Unable to Shrink Volume C: there is not enough free space??? Overheal Vista Help 3 19-06-2008 08:48 PM


All times are GMT +5.5. The time now is 04:44 AM.