473,748 Members | 4,935 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

NetServerDiskEn um in win32net

I try to get all logical drives of a remote machine (WinNT or W2K) and
get a result, that gives me the expected total but not all expected drives.

Example:
win32net.NetSer verDiskEnum('no r1w020', 0) gives me:

([u'A:', u'', u'C:', u'', u'D:', u'', u'E:', u''], 8, 0)

while the machine has the local drives
A: C: D: E: F: G: H: Z:
A: - Floppy
Z: - CDROM
All others are harddisk partitions on two physical drives

Does anyone have an idea?

Thanks
Uwe

Jul 18 '05 #1
4 1769
Hi !

I try, and i have same result. But, i have no read doc...

--
Michel Claveau
Jul 18 '05 #2
There's a bug in this function. (also a related memory leak)
I've been meaning to submit a patch for it, but I hadn't heard
anybody else complain about it yet.
Roger
"Uwe Becher" <ub*****@gmx.ne t> wrote in message
news:bi******** *****@news.t-online.com...
I try to get all logical drives of a remote machine (WinNT or W2K) and
get a result, that gives me the expected total but not all expected drives.
Example:
>>> win32net.NetSer verDiskEnum('no r1w020', 0) gives me:

([u'A:', u'', u'C:', u'', u'D:', u'', u'E:', u''], 8, 0)

while the machine has the local drives
A: C: D: E: F: G: H: Z:
A: - Floppy
Z: - CDROM
All others are harddisk partitions on two physical drives

Does anyone have an idea?

Thanks
Uwe

Jul 18 '05 #3
Uwe Becher <ub*****@gmx.ne t> wrote in message news:<bi******* ******@news.t-online.com>...
I try to get all logical drives of a remote machine (WinNT or W2K) and
get a result, that gives me the expected total but not all expected drives.

Example:
>>> win32net.NetSer verDiskEnum('no r1w020', 0) gives me:

([u'A:', u'', u'C:', u'', u'D:', u'', u'E:', u''], 8, 0)

while the machine has the local drives
A: C: D: E: F: G: H: Z:
A: - Floppy
Z: - CDROM
All others are harddisk partitions on two physical drives

Does anyone have an idea?

Thanks
Uwe


I had the same problem, and to my shame I didn't raise it as a bug, I
simply bypassed it (because my DBA needed the info immediately anyway)
by using wmi. Have a look at
http://tgolden.sc.sabren.com/python/wmi.html and then try something
like this:

<code>

import wmi
c = wmi.WMI ("") # or whatever host name

for disk in c.Win32_Logical Disk (DriveType=3):
print disk.Caption

</code>

TJG
Jul 18 '05 #4
Tim Golden wrote:
Uwe Becher <ub*****@gmx.ne t> wrote in message news:<bi******* ******@news.t-online.com>...
I try to get all logical drives of a remote machine (WinNT or W2K) and
get a result, that gives me the expected total but not all expected drives.

Example:
>>> win32net.NetSer verDiskEnum('no r1w020', 0) gives me:

([u'A:', u'', u'C:', u'', u'D:', u'', u'E:', u''], 8, 0)

while the machine has the local drives
A: C: D: E: F: G: H: Z:
A: - Floppy
Z: - CDROM
All others are harddisk partitions on two physical drives

Does anyone have an idea?

Thanks
Uwe

I had the same problem, and to my shame I didn't raise it as a bug, I
simply bypassed it (because my DBA needed the info immediately anyway)
by using wmi. Have a look at
http://tgolden.sc.sabren.com/python/wmi.html and then try something
like this:

<code>

import wmi
c = wmi.WMI ("") # or whatever host name

for disk in c.Win32_Logical Disk (DriveType=3):
print disk.Caption

</code>

TJG

Tim,

that did the job, thanks!

Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1044
by: Robin Becker | last post by:
I'm trying to centralize changing the administrator password on our mini office net and the following works OK for all of the win2k clients. win32net.NetUserChangePassword(comp, 'Administrator', current, next) however, it fails with access denied for the XP machines and I'm not clever enough to work out why. I do notice that XP seems to have a different system drive (Windows instead of Winnt) and that I am unable to work out how to ...
1
1866
by: python1 | last post by:
Do you know of a way to list the users on a Win2K machine? I can't seem to find a module for this. Thanks.
1
2824
by: Doran_Dermot | last post by:
Hi All, I'm currently using "os.listdir" to obtain the contents of some slow Windows shares. I think I've seen another way of doing this using the win32 library but I can't find the example anymore. My main problem with using "os.listdir" is that it hangs my gui application. The tread running the "os.listdir" appears to block all other threads when it calls this function.
1
1873
by: Shin | last post by:
Hi all, I'm new to the python language and I'm having trouble. I'm writing a basic chat script...real basic. It's client-server based and I'm wanting the roles to change -- client becomes server and vice versa. The problem is when I do this, the server switches to the client no problem. However, when the client tries to switch to server mode, it can't because the previous server is still bound to the socket it wants to use. I've tried...
1
3321
by: Read Roberts | last post by:
I am trying to use win32net on a Windows 2000 Japanese system, and discover that it won't import. I found a message describing the problem (see below) but can't find any response, and don't see a bug report on the SourceForge site for this. . Can anyone tell me if this has ben fixed? An early message in 2000 said that win32net is supposed to run on Windows 2000 I find the same problem reported, with more detail, on the py2exe user...
1
8740
by: Lucas Machado | last post by:
I'm using the win32 api to map samba shares, and I'm having trouble handling some exceptions. In my script there are 2 possible exceptions when the script attempts to map a share: >>> win32net.NetUseAdd(None, 1, {'remote':r'\\foo\bar','local':'X Traceback (most recent call last): File "<stdin>", line 1, in ? pywintypes.error: (53, 'NetUseAdd', 'The network path was not found.') This exception occurs when '\\foo\bar' is not an...
8
2657
by: kyosohma | last post by:
Hi, I am trying to query our domain to get a list of our users profile locations. I thought I might be able to use WMI, but I can't get it to work. I am using a Windows XP Pro workstation and Python 2.4 on a mixed environment of Debian Linux (with Samba) and Windows servers. We are in the process of moving the user profiles from an NT box to a Debian box, but due to the many different servers in the organization, it is a pain to keep...
6
16011
by: pydou | last post by:
please give me a hand, anything about this topic is welcome. thanks
2
3492
by: Sean Peterson | last post by:
Has anyone had success using NetUseAdd() on shares that were replica links on a Windows 2003 DFS root? In my code, I'm getting error: pywintypes.error: (67, 'NetUseAdd', 'The network name cannot be found.') This is my scenario: Win2003 Server hosting DFS root #NTS-03 \\NTS-03.central.purdue.lcl\MI
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8830
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9321
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8242
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6074
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4602
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2782
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.