We use the code below to create a user from a program we built. All variables are declared of course. It works great - first creating the user and then adding that user into the proper group. However, is there a way to set the password to be non-expiring right when the user is created? Are there a couple of lines of script I can add that will set this flag? This code creates local users on a machine.
Question
reactionary007
We use the code below to create a user from a program we built. All variables are declared of course. It works great - first creating the user and then adding that user into the proper group. However, is there a way to set the password to be non-expiring right when the user is created? Are there a couple of lines of script I can add that will set this flag? This code creates local users on a machine.
objWshNet = CreateObject("WScript.Network")
strComputer = objWshNet.ComputerName
colAccounts = GetObject("WinNT://" & strComputer & ",computer")
objUser = colAccounts.Create("user", sUserName)
objUser.SetPassword(sPassword)
objUser.SetInfo()
objGroup = GetObject("WinNT://" & strComputer & "/xfer_users,group")
objGroup.Add(objUser.ADsPath)
Link to comment
Share on other sites
1 answer to this question
Recommended Posts