TCMD14 & free for JUNCTION's

Jun 7, 2008
121
0
Hi

Just a question which I asked some time back with TCMD13

Is it possible to find out how much space is left on a JUNCTION or mounted drive with TCMD14?

Some software called TreeSize Professional does do that in that you can see at a glance how much space is left on each junction drive.

Also see the example under
"Disk Space Reporting Does Not Include Junction Point Targets"
http://support.microsoft.com/KB/197000
What I would like to find out (in the example) is the size of C:\Volume2 and how much space free it has (so I have some idea whether a mounted drive is about to run out of disk space). In the example, this is 1Gb with 800Mb free for C:\Volume2

Thanks

Stephen Howe
 
May 20, 2008
3,515
3
Elkridge, MD, USA
I have not used mounted drives. but juctions and symbolic links can be resolved to their true drive using @junction[] and @symlink[], resp., or with @truename[], so you should be able to do something like this:
echo %@diskfree[%@truename[C:\Volume2]]
HTH!
 
Jun 7, 2008
121
0
I have not used mounted drives. but juctions and symbolic links can be resolved to their true drive using @junction[] and @symlink[], resp., or with @truename[], so you should be able to do something like this:
echo %@diskfree[%@truename[C:\Volume2]]
HTH!
Unfortunately it does not workl on Junction drives. I see

[M:\TVPCDev]echo %@diskfree[%@truename[.]]
TCC: (Sys) The system cannot find the path specified.
"Volume{c3492014-ab0c-4017-92a6-929589b79502}\"

It work on my local Hard Disk, the DVDRom drive (reporting 0) and an IOmega Portable drive and M:\
It could be a rights issue.

Thanks

Stephen Howe
 
May 20, 2008
9,898
71
Syracuse, NY, USA
You can do this (below) if you know either the volume ID or the volume index. The volume below is 1GB a letter-less partition mounted on several TCC "Plugin" directories.

Code:
v:\> echo %@diskfree[\\?\Volume{53c5ee55-6a1a-11e1-b966-806e6f6e6963}\]
1039945728
 
v:\> echo %@wmi[.,"select freespace from win32_volume",2]
1039945728
There may be an easier way with @WMI.

You can hunt for the ID or index you want. After trying various indexes, I found index 2 is the one I want (see below). With that info, I can get its FreeSpace directly (with @WMI, by index, as above) or find its ID (below) and use @DISKFREE (as above).

Code:
v:\> echo %@wmi[.,"select caption from win32_volume",2]
G:\TC11\Plugins\
 
v:\> echo %@wmi[.,"select deviceid from win32_volume",2]
\\?\Volume{53c5ee55-6a1a-11e1-b966-806e6f6e6963}\
This works too (given the ID) but gives a more verbose response that you probably want.
Code:
v:\> free \\?\Volume{53c5ee55-6a1a-11e1-b966-806e6f6e6963}\

 Volume in \\?\Volume{53c5ee55-6a1a-11e1-b966-806e6f6e6963}\ is DATA           Serial number is c007:d3e4
     1,077,510,144 bytes total disk space
        37,564,416 bytes used
     1,039,945,728 bytes free
               3.5 % in use
Rex, does @WMI support the "WHERE" syntax? All attempts like the one below failed.
Code:
v:\> echo %@wmi[.,"select freespace from win32_volume where caption contains 'pl
ugins'"]
TCC: (Sys) The parameter is incorrect.
 "%@wmi[.,"select freespace from win32_volume where caption contains 'plugins'"]
"
 
May 20, 2008
9,898
71
Syracuse, NY, USA
If the volume is labelled, you can do it all at once:
Code:
v:\> echo %@wmi[.,"select FreeSpace from Win32_Volume where Label = 'Plugins'"]
1039945728
 
May 20, 2008
3,515
3
Elkridge, MD, USA
Another (possibly simpler) method might be to subtract the free space of the host volume from the free space of the combination, though that would fail if you have more than one mounted volume.
 
May 20, 2008
3,515
3
Elkridge, MD, USA
If the volume is labelled, you can do it all at once:
Code:
v:\> echo %@wmi[.,"select FreeSpace from Win32_Volume where Label = 'Plugins'"]
1039945728
Did not work on my system (WinXP Home SP3). No matter whether I use a local drive's label, or one mapped from the LAN, I get the message
TCC: (Sys) The parameter is incorrect.
 
May 20, 2008
9,898
71
Syracuse, NY, USA
Did not work on my system (WinXP Home SP3). No matter whether I use a local drive's label, or one mapped from the LAN, I get the message
TCC: (Sys) The parameter is incorrect.
And it doesn't work on my XP/SP3/Pro system ... must be improvements in Windows Management Instrumentation between XP and Win7.
 
May 20, 2008
9,898
71
Syracuse, NY, USA
The Win32_Volume class does not exist in XP. I recommend getting (from MS) and playing with the "WMI Code Creator".
 
May 20, 2008
9,898
71
Syracuse, NY, USA
Unfortunately it does not workl on Junction drives. I see

[M:\TVPCDev]echo %@diskfree[%@truename[.]]
TCC: (Sys) The system cannot find the path specified.
"Volume{c3492014-ab0c-4017-92a6-929589b79502}\"
It work on my local Hard Disk, the DVDRom drive (reporting 0) and an IOmega Portable drive and M:\
It could be a rights issue.
So without all thefancy WMI stuff, try

Code:
[M:\TVPCDev]echo %@diskfree[\\?\%@truename[.]]

It works here (Win7):
Code:
v:\> echo %@diskfree[\\?\%@truename[g:\tc11\Plugins\]]
1039945728
 
v:\> g:\tc11\Plugins\
 
g:\tc11\plugins> echo %@diskfree[\\?\%@truename[.]]
1039945728
 
Jun 7, 2008
121
0
Vince,
I tried

echo %@diskfree[\\?\%@truename[.]]
and got

[M:\TVPCDev]echo %@diskfree[\\?\%@truename[.]]
TCC: (Sys) The system cannot find the path specified.
"\\?\Volume{c3492014-ab0c-4017-92a6-929589b79502}\"

and here is me trying various syntax variations (only one works - the simplest)

[M:\TVPCDev]echo %@diskfree[\\?\%@truename[..]]
TCC: (Sys) The filename, directory name, or volume label syntax is incorrect.
"\\?\\\Uktnswg-fs03.tnsad.com\TVData\"

[M:\TVPCDev]echo %@diskfree[\\?\\%@truename[..]]
TCC: (Sys) The filename, directory name, or volume label syntax is incorrect.
"\\?\\\\Uktnswg-fs03.tnsad.com\TVData\"

[M:\TVPCDev]echo %@diskfree[\\?%@truename[..]]
TCC: (Sys) The system cannot find the path specified.
"\\?\\Uktnswg-fs03.tnsad.com\TVData\"

[M:\TVPCDev]echo %@diskfree[%@truename[..]]
770834432

[M:\TVPCDev]echo %@diskfree[%@truename[.]]
TCC: (Sys) The system cannot find the path specified.
"Volume{c3492014-ab0c-4017-92a6-929589b79502}\"

I just conclude it cannot "see" through the Junction

Thanks

Stephen
 
Jun 7, 2008
121
0
Vince, I think I might experiment with WBEM and WMI, as you indicated, see if I can persuade them to work

Thanks for the help

Stephen Howe
 
May 20, 2008
9,898
71
Syracuse, NY, USA
Stephen, what's your OS?
I'm talking (only) about disk volumes mounted on empty directories. My original tests were on Win7. I just tried it on XP/SP3 and it worked there too.
Code:
d:\tc13> echo %@truename[aamount]
Volume{f8b2de41-b442-11e1-9928-0026b97f7f8e}\
 
d:\tc13> echo %@diskfree[\\?\%@truename[aamount\]]
23604056064
 
d:\tc13> echo %@truename[aamount]
Volume{f8b2de41-b442-11e1-9928-0026b97f7f8e}\
 
d:\tc13> echo %@diskfree[\\?\%@truename[aamount]]
23604056064
 
d:\tc13> aamount\
 
d:\tc13\aamount> echo %@diskfree[\\?\%@truename[.]]
23604056064
 
Jun 7, 2008
121
0
Vince it is XP Professional, SP3. All security patches applied for all products.

I have

TCC 13.04.63 Windows XP [Version 5.1.2600]
TCC Build 63 Windows XP Build 2600 Service Pack 3

Thanks

Stephen Howe
 
May 20, 2008
9,898
71
Syracuse, NY, USA
Stephen, I have no idea why it works for me on XP but doesn't work for you. If it really is a mounted volume, you might check that @TRUENAME[] and MOUNTVOL.EXE (/L(ist)) agree. Here I see
Code:
v:\> mountvol d:\tc13\aamount\ /L
    \\?\Volume{f8b2de41-b442-11e1-9928-0026b97f7f8e}\
 
v:\> echo %@truename[d:\tc13\aamount\]
Volume{f8b2de41-b442-11e1-9928-0026b97f7f8e}\