find free hard disk space remote windows host
Tim Golden
mail at timgolden.me.uk
Mon Aug 31 14:39:56 EDT 2009
Daniel wrote:
> Hello,
>
> I'm trying to determine the amount of free hard disk space on a remote
> windows host. Seems like this should be simple, but it's giving me
> grief. Here's what I've tried:
>
>>>> mystat = os.stat('//remotehost/share/')
>>>> mystat
> (16895, 0L, 0, 0, 0, 0, 0L, 1251731920, 1251731289, 1249399952)
Assuming you have the necessary security levels,
WMI's quite good at this kind of thing. See this
example:
http://timgolden.me.uk/python/wmi_cookbook.html#percentage_free
and just add "remotehost" as the first parameter to the
wmi.WMI () call. (And I recommend find_classes=False) for
speed.
TJG
More information about the Python-list
mailing list