[python-win32] Accessing properties of share on DFS
Tim Golden
mail at timgolden.me.uk
Wed Aug 27 15:35:37 CEST 2008
Michael Kesper wrote:
> Until now I'm using win32net.NetSessionEnum to list sessions users have
> open. Now homes will be migrated to Distributed Filesystem (DFS).
> As far as I understood msdn I should access that via win32wnet.
> But now, I have some troubles to figure out how this really works.
> The following script gives me an error 87, "wrong parameter" at the call
> of WNetOpenEnum:
You might be able to get there with WMI. The following
works on my own machine, but I'm not sure what machine
you'd need to access to list the DFS shares. I'll see
if I can persuade a friendly admin here to let me try
things out:
<code>
import wmi
c = wmi.WMI ()
for share in c.Win32_Share (Type=0):
print share.Caption, share.Path
for session in share.associators (
wmi_result_class="Win32_ServerConnection"
):
print " ", session.UserName, session.ActiveTime
</code>
or you could come from the other end and enumerate
the Win32_ServerConnection collection to start with.
As I say, I'll try to get one of our admins let me
have a go with a DFS share to see if I can get
something working.
TJG
More information about the python-win32
mailing list