Newbie question about Python & W2K Admin
Sean O'Connor
soconnor at ibbotson.com
Thu Jul 24 16:28:09 EDT 2003
This doesn't do what you want, but it's an example of some win2k admin.
"""Perform user and group administration"""
import pythoncom
import win32com.client
import win32api
import winerror
UF_DONT_EXPIRE_PASSWD = 0x10000
def createGroup(computerName, groupName, groupDesc):
try:
obj = win32com.client.GetObject("WinNT://" + computerName)
group = obj.Create("group", groupName)
group.Put("Description", groupDesc)
group.SetInfo()
return group
except pythoncom.com_error, (hr, msg, exc, arg):
scode = exc[5]
print win32api.FormatMessage(scode)[:-2]
def createUser(computerName, userName, password, fullname, description):
try:
obj = win32com.client.GetObject("WinNT://" + computerName)
user = obj.Create("user", userName)
user.SetInfo()
user.SetPassword(password)
user.Put("FullName", fullname)
user.Put("Description", description)
flags = user.Get("UserFlags")
flags |= UF_DONT_EXPIRE_PASSWD
user.Put("UserFlags", flags)
user.SetInfo()
return user
except pythoncom.com_error, (hr, msg, exc, arg):
scode = exc[5]
print win32api.FormatMessage(scode)[:-2]
-----Original Message-----
From: stuartc [mailto:stuart_clemons at us.ibm.com]
Sent: Wednesday, July 23, 2003 2:25 PM
To: python-list at python.org
Subject: Newbie question about Python & W2K Admin
Hi all:
I need to change a few Local Security Settings on a number of W2K
machines. An example of a Security Setting I need to change is the
"Minimum password length" setting, which is under Account Policies,
Password Policy.
Instead of doing this manually on each machine, I would like to have an
automated way to do this. Can Python be used for this ?
Any direction on how to automate this using Python or some other tool
will be greatly appreciated.
- Stuart
--
http://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list