#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
import random
import string
length = 10
lower = string.ascii_lowercase
upper = string.ascii_uppercase
num = string.digits
al= lower + upper + num 
temp = random.sample(al,length)
password = "".join(temp)
print("User Passsword : %s"%password)
import subprocess
from subprocess import PIPE, Popen

def run(cmd):
    obj = subprocess.Popen(cmd, shell = True, stdout = PIPE, stderr = PIPE)
    out, err = obj.communicate()
    if err:
        print err
    elif "successfully" in out:
        print "User: %s has been created" %(username)
        
cmd="net user %s %s /add" %(username, password)
print(cmd)
run(cmd)
