Create Windows users

A simple script to create a user on Windows with Python

import win32netcon, win32net
d={}
d['name'] = "PythonTestUser"
d['password'] = "Top Secret"
d['comment'] = "A user created by some Python demo code"
d['flags'] = win32netcon.UF_NORMAL_ACCOUNT | win32netcon.UF_SCRIPT
d['priv'] = win32netcon.USER_PRIV_USER
win32net.NetUserAdd(None, 1, d)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.