Results 1 to 2 of 2

Thread: Free disk space from volume mount point.

  1. #1
    Albert Kikkert Guest

    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.



  2. #2
    Albert Kikkert Guest

    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.
    >




Similar Threads

  1. Replies: 5
    Last Post: 30-01-2012, 05:42 PM
  2. There is not enough free disk space to run Steam
    By Ameeryan in forum Video Games
    Replies: 3
    Last Post: 28-08-2009, 11:31 PM
  3. Free up disk space.
    By halutz in forum Operating Systems
    Replies: 3
    Last Post: 01-11-2008, 12:25 PM
  4. How to free up disk space?
    By Bhairav in forum Hardware Peripherals
    Replies: 2
    Last Post: 30-07-2008, 03:31 PM
  5. Replies: 3
    Last Post: 19-06-2008, 08:48 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,958,862.63479 seconds with 16 queries