Working with Users and Groups
The Windows NT API provides a rich set of functions to control Windows NT users and groups. To cope with the large number of attributes stored for users and groups, Windows NT defines different information levels for these objects. Programs that require only minimal information, such as the user or group name, can specify an information level that returns only this information. Other programs may wish to view all information available for a user, and will specify a different information level when accessing user information.
The Python support for NT users, groups, shares, servers, and so
forth is in the module
win32net
. This module uses dictionaries to set
and obtain information about these objects. When you request
information about an object, a dictionary is returned; the
information level you specify determines the items in the dictionary.
When you create or modify information about a user, you pass a
dictionary; the information level you specify determines which
dictionary elements are expected to exist.
For example, when working with users, if you specify an information
level of 1, the data is in the format defined for
PyUSER_INFO_1. If you specify an information level
of 102 when dealing with servers, the data is in the format defined
for PySERVER_INFO_102. Appendix B, describes the different information levels
and the data.
Most of the Windows NT administration functions take as their first parameter the name of a server on which to execute ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access