Lodester
29th July 2010 20:49 UTC
Get drive freespace question
I have form that takes input for a remote drive path, meaning the label asks for a path on the remove server. I'm looking for a way to query that drive remotely. I will have the server and drive letter, so
MyServer
G:\Backups\
The installer will be running remote to "MyServer" so i need to use something to query the server and get freespace on the G: drive.
I am thinking a WMI call is perhaps the best way to get this done, but I have not ventured in to calling WMI yet in NSIS
Can anyone suggest whether i'm on the right track, and if so (or if not, alternatives?), are there any good examples I can use to do some of my own testing for this?
Thanks very much for your help!
jpderuiter
29th July 2010 22:25 UTC
At first look I thought you could use the WmiInspector plugin, using:
WmiInspector
::Request"CIMV2""Win32_MappedLogicalDisk""FreeSpace"
But unfortunartely, this will return a uint64 variable, which is unhandled by the plugin.
So I'm afraid you'll have to adapt the plugin for that.
Animaether
29th July 2010 22:28 UTC
Can't say I have any idea about arbitrary paths that aren't shared.
If the path is shared and mounted you can use the File Functions header's ${DriveSpace} functionality.
If the path is shared but not mounted, you could try http://nsis.sourceforge.net/CheckSpaceFree (setting the path as \\Server\ShareName\)
Lodester
30th July 2010 00:57 UTC
Originally posted by Animaether
If the path is shared but not mounted, you could try http://nsis.sourceforge.net/CheckSpaceFree (setting the path as \\Server\ShareName\)
It looks like this will work for my purposes - thanks so much!