FAQ
I tried the command "net user /DOMAIN" in windows console(cmd.exe),
and it showed me all the usernames in my domain without any problems.
But when I tried it in python with these commands :
info=win32net.NetUserEnum("DOMAIN_NAME",1),
info=win32net.NetUserEnum(r"\\DOMAIN_NAME",1),and
info=win32net.NetUserEnum("\\\\DOMAIN_NAME",1), I all got the System
Error 53 (The network path was not found) .

What should I do, if I intend to enum all the users from a windows
domain via python win32net module?

Search Discussions

  • Tim Golden at Feb 16, 2009 at 10:00 am

    vimuser wrote:
    I tried the command "net user /DOMAIN" in windows console(cmd.exe),
    and it showed me all the usernames in my domain without any problems.
    But when I tried it in python with these commands :
    info=win32net.NetUserEnum("DOMAIN_NAME",1),
    info=win32net.NetUserEnum(r"\\DOMAIN_NAME",1),and
    info=win32net.NetUserEnum("\\\\DOMAIN_NAME",1), I all got the System
    Error 53 (The network path was not found) .

    What should I do, if I intend to enum all the users from a windows
    domain via python win32net module?
    --
    http://mail.python.org/mailman/listinfo/python-list
    <code>

    import win32net
    import win32netcon

    dc = win32net.NetGetAnyDCName (None, None)

    resume = 0
    while 1:
    (_users, total, resume) = \
    win32net.NetUserEnum (
    dc,
    3,
    win32netcon.FILTER_NORMAL_ACCOUNT,
    resume,
    win32netcon.MAX_PREFERRED_LENGTH
    )
    for _user in _users:
    print _user['name'], _user['home_dir'], _user['profile']
    break
    if not resume:
    break


    </code>

    TJG

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedFeb 16, '09 at 9:39a
activeFeb 16, '09 at 10:00a
posts2
users2
websitepython.org

2 users in discussion

Vimuser: 1 post Tim Golden: 1 post

People

Translate

site design / logo © 2022 Grokbase