#To define a particular parameter, replace the 'parameterName' inside itsm.getParameter('parameterName') with that parameter's name
username=itsm.getParameter('username') #Provide the new user name eg: John
password=itsm.getParameter('password') #Provide the new password for the user eg: xxxxxxx
passwordExpire = itsm.getParameter('passwordExpire') #provide 0 if you need the password to expire after some months and ask to renew it or provide 1 if you don't need the password to expire.

import subprocess
from subprocess import PIPE, Popen

def run(cmd):
    obj = subprocess.Popen(cmd, shell = True, stdout = PIPE, stderr = PIPE)
    out, err = obj.communicate()
    return (out,err)

output,error = run("net user %s %s /add" %(username, password))

if error:
    print error
elif "successfully" in output:
    print "User: %s has been created" %(username)
    cmd1="net localgroup administrators %s /add" %(username)
    output,error = run(cmd1)
    if error:
        print error
    elif "successfully" in output:
        print "Administrator priviliges has been added to the user: %s" %(username)
        if passwordExpire==1:
            run("wmic useraccount where \"Name='%s'\" set PasswordExpires=false"%(username))
            print("password set to never expire")