Prev: Casting in VB6
Next: VB6 new install
From: Dipesh_Sharma on 29 Jul 2010 14:13 Hi, I want to create an application which on passing a user id & password will create that user on windows 2003 AD server. I used netuseradd API to do this, but was not able to create user on AD server & boot my system with that user. CAn anybody please help me do this. if i am doing right what could be the problem. i am getting unknown user type error. i found few scripts but they need to be run on server itself not on remote system in network. Thanks
From: Paul Clement on 29 Jul 2010 15:01 On Thu, 29 Jul 2010 11:13:25 -0700, Dipesh_Sharma <DipeshSharma(a)discussions.microsoft.com> wrote: � Hi, � I want to create an application which on passing a user id & password will � create that user on windows 2003 AD server. I used netuseradd API to do this, � but was not able to create user on AD server & boot my system with that user. � CAn anybody please help me do this. if i am doing right what could be the � problem. i am getting unknown user type error. i found few scripts but they � need to be run on server itself not on remote system in network. � � Thanks A little more detail would help. Are you creating a domain user or a system local user? Does the error occur when you attempt to log on to the server interactively? What is the exact error message? Paul ~~~~ Microsoft MVP (Visual Basic)
From: Jim Mack on 29 Jul 2010 16:04 Dipesh_Sharma wrote: > Hi, > I want to create an application which on passing a user id & > password will create that user on windows 2003 AD server. I used > netuseradd API to do this, but was not able to create user on AD > server & boot my system with that user. CAn anybody please help me > do this. if i am doing right what could be the problem. i am > getting unknown user type error. i found few scripts but they need > to be run on server itself not on remote system in network. Perhaps you could post the VB6 code you're using now, and we can spot a problem... -- Jim Mack Twisted tees at http://www.cafepress.com/2050inc "We sew confusion"
From: Dipesh_Sharma on 1 Aug 2010 14:24 Hi Paul, Thnx for replying. I am creating a domain user on msd.com, not a local user on client machine, through a client machine with following code. Sometime the error was related to path not found, and sometime logon failure. Please review the code and correct it so that it can create the user on windows server. I am using following code::::: xi_strServerName = "virtual-server" 'netbios name, i also used domain name msd.com here xi_strUserName = "newuser" xi_strUserFullName = "test newuser" xi_strPassword = "user(a)123" xi_strUserComment = "test user" p_lngFlags = UF_NORMAL_ACCOUNT Or UF_SCRIPT Or UF_DONT_EXPIRE_PASSWD WriteLog "staging in AD user..." ' ------------------------------------------ ' Create byte arrays to avoid Unicode hassles ' ------------------------------------------ p_abytServerName = xi_strServerName & vbNullChar p_abytUserName = xi_strUserName & vbNullChar p_abytUserFullName = xi_strUserFullName & vbNullChar p_abytPassword = xi_strPassword & vbNullChar p_abytUserComment = xi_strUserComment & vbNullChar ' ------------------------------------------ ' Get pointers to the byte arrays ' ------------------------------------------ p_lngPtrUserName = VarPtr(p_abytUserName(0)) p_lngPtrUserFullName = VarPtr(p_abytUserFullName(0)) p_lngPtrPassword = VarPtr(p_abytPassword(0)) p_lngPtrUserComment = VarPtr(p_abytUserComment(0)) With p_typUserInfo3 .usri3_acct_expires = TIMEQ_FOREVER ' Never expires .usri3_comment = p_lngPtrUserComment ' Comment .usri3_flags = p_lngFlags ' There are a number of variations .usri3_full_name = p_lngPtrUserFullName ' User's full name .usri3_max_storage = USER_MAXSTORAGE_UNLIMITED ' Can use any amount of disk space .usri3_name = p_lngPtrUserName ' Name of user account .usri3_password = p_lngPtrPassword ' Password for user account .usri3_primary_group_id = DOMAIN_GROUP_RID_USERS ' You MUST use this constant for NetUserAdd .usri3_script_path = 0& ' Path of user's logon script .usri3_auth_flags = 0& ' Ignored by NetUserAdd .usri3_bad_pw_count = 0& ' Ignored by NetUserAdd .usri3_code_page = 0& ' Code page for user's language .usri3_country_code = 0& ' Country code for user's language .usri3_home_dir = 0& ' Can specify path of home directory of this 'user .usri3_home_dir_drive = 0& ' Drive letter assign to user's 'profile .usri3_last_logoff = 0& ' Not needed when adding a user .usri3_last_logon = 0& ' Ignored by NetUserAdd .usri3_logon_hours = 0& ' Null means no restrictions .usri3_logon_server = 0& ' Null means logon to domain server .usri3_num_logons = 0& ' Ignored by NetUserAdd .usri3_parms = 0& ' Used by specific applications .usri3_password_age = 0& ' Ignored by NetUserAdd .usri3_password_expired = 0& ' None-zero means user must change password at next logon .usri3_priv = 0& ' Ignored by NetUserAdd .usri3_profile = 0& ' Path to a user's profile .usri3_units_per_week = 0& ' Ignored by NetUserAdd .usri3_user_id = 0& ' Ignored by NetUserAdd .usri3_usr_comment = 0& ' User comment .usri3_workstations = 0& ' Workstations a user can log onto (null = all stations) End With WriteLog "creating AD user from NetUserAdd..." Dim objComputer Dim strComputer As String p_lngRtn = NetUserAdd(p_abytServerName(0), _ 3, p_typUserInfo3, p_lngParamErr) 'code ends "Paul Clement" wrote: > On Thu, 29 Jul 2010 11:13:25 -0700, Dipesh_Sharma <DipeshSharma(a)discussions.microsoft.com> wrote: > > ¤ Hi, > ¤ I want to create an application which on passing a user id & password will > ¤ create that user on windows 2003 AD server. I used netuseradd API to do this, > ¤ but was not able to create user on AD server & boot my system with that user. > ¤ CAn anybody please help me do this. if i am doing right what could be the > ¤ problem. i am getting unknown user type error. i found few scripts but they > ¤ need to be run on server itself not on remote system in network. > ¤ > ¤ Thanks > > A little more detail would help. Are you creating a domain user or a system local user? Does the > error occur when you attempt to log on to the server interactively? What is the exact error message? > > > Paul > ~~~~ > Microsoft MVP (Visual Basic) > . >
From: Dipesh_Sharma on 1 Aug 2010 14:26
Hi Jim, Thnx for replying. I am creating a domain user on msd.com through a client machine with following code. Please review the code and correct it so that it can create the user on windows server. I am using following code::::: xi_strServerName = "virtual-server" 'netbios name, i also used domain name msd.com here xi_strUserName = "newuser" xi_strUserFullName = "test newuser" xi_strPassword = "user(a)123" xi_strUserComment = "test user" p_lngFlags = UF_NORMAL_ACCOUNT Or UF_SCRIPT Or UF_DONT_EXPIRE_PASSWD WriteLog "staging in AD user..." ' ------------------------------------------ ' Create byte arrays to avoid Unicode hassles ' ------------------------------------------ p_abytServerName = xi_strServerName & vbNullChar p_abytUserName = xi_strUserName & vbNullChar p_abytUserFullName = xi_strUserFullName & vbNullChar p_abytPassword = xi_strPassword & vbNullChar p_abytUserComment = xi_strUserComment & vbNullChar ' ------------------------------------------ ' Get pointers to the byte arrays ' ------------------------------------------ p_lngPtrUserName = VarPtr(p_abytUserName(0)) p_lngPtrUserFullName = VarPtr(p_abytUserFullName(0)) p_lngPtrPassword = VarPtr(p_abytPassword(0)) p_lngPtrUserComment = VarPtr(p_abytUserComment(0)) With p_typUserInfo3 .usri3_acct_expires = TIMEQ_FOREVER ' Never expires .usri3_comment = p_lngPtrUserComment ' Comment .usri3_flags = p_lngFlags ' There are a number of variations .usri3_full_name = p_lngPtrUserFullName ' User's full name .usri3_max_storage = USER_MAXSTORAGE_UNLIMITED ' Can use any amount of disk space .usri3_name = p_lngPtrUserName ' Name of user account .usri3_password = p_lngPtrPassword ' Password for user account .usri3_primary_group_id = DOMAIN_GROUP_RID_USERS ' You MUST use this constant for NetUserAdd .usri3_script_path = 0& ' Path of user's logon script .usri3_auth_flags = 0& ' Ignored by NetUserAdd .usri3_bad_pw_count = 0& ' Ignored by NetUserAdd .usri3_code_page = 0& ' Code page for user's language .usri3_country_code = 0& ' Country code for user's language .usri3_home_dir = 0& ' Can specify path of home directory of this 'user .usri3_home_dir_drive = 0& ' Drive letter assign to user's 'profile .usri3_last_logoff = 0& ' Not needed when adding a user .usri3_last_logon = 0& ' Ignored by NetUserAdd .usri3_logon_hours = 0& ' Null means no restrictions .usri3_logon_server = 0& ' Null means logon to domain server .usri3_num_logons = 0& ' Ignored by NetUserAdd .usri3_parms = 0& ' Used by specific applications .usri3_password_age = 0& ' Ignored by NetUserAdd .usri3_password_expired = 0& ' None-zero means user must change password at next logon .usri3_priv = 0& ' Ignored by NetUserAdd .usri3_profile = 0& ' Path to a user's profile .usri3_units_per_week = 0& ' Ignored by NetUserAdd .usri3_user_id = 0& ' Ignored by NetUserAdd .usri3_usr_comment = 0& ' User comment .usri3_workstations = 0& ' Workstations a user can log onto (null = all stations) End With WriteLog "creating AD user from NetUserAdd..." Dim objComputer Dim strComputer As String p_lngRtn = NetUserAdd(p_abytServerName(0), _ 3, p_typUserInfo3, p_lngParamErr) 'code ends "Jim Mack" wrote: > Dipesh_Sharma wrote: > > Hi, > > I want to create an application which on passing a user id & > > password will create that user on windows 2003 AD server. I used > > netuseradd API to do this, but was not able to create user on AD > > server & boot my system with that user. CAn anybody please help me > > do this. if i am doing right what could be the problem. i am > > getting unknown user type error. i found few scripts but they need > > to be run on server itself not on remote system in network. > > Perhaps you could post the VB6 code you're using now, and we can spot > a problem... > > -- > Jim Mack > Twisted tees at http://www.cafepress.com/2050inc > "We sew confusion" > > . > |