How to Update User Accounts
Keywords: wntUserAddDat
Question:
Is there a way to update a specific field for all user accounts. Example change logon script name from "LOGON.BAT" to "LOGON1.BAT". Need it to find each instance and change it accordingly.Answer:
See in the Win32 Network Extender help file the wntUserAddDat function, eg:AddExtender("WWWNT34I.DLL") wntUserAddDat("name", "jdoe") wntUserAddDat("full_name", "John Doe") wntUserAdd("") exitFor the first parameter, which can consist of a number of elements, an example of how to set flags might look like:wntUserAddDat("home_dir","C:\users\shan") flags=64+???+???+??? wntUserAddDat("flags",flags)where the value of flags needs to be the total value of all the flags you need. The way usually to figure it out is to manually set up one user exactly how you like it then use the wntUserGetDat function to get the flags value and use that value for flags.
Question: Cannot rename user with wntUserSetDat
I am unable to rename a user account with the wntUserSetDat function. I am logged in as Administrator, and other elements such as full_name and comment work fine:AddExtender("WWWNT34I.DLL") wntUserSetDat("","olduser","name", "newuser")Answer:
Ummm yes. wntUserSetDat was not designed for that purpose.Use wntUserRename to rename the user account.
Another Question on Flags:
I try to add a user account to the local SAM and add it to a local WinNT group (admin group) with the following code:wntUserAddDat("name", strUserName) wntUserAddDat("password", strUserPwd) wntUserAddDat("flags", 1) wntUserAddDat("usr_comment", "") wntUserAddDat("flags", 65536) wntUserAdd("") wntMemberSet("", strAdminGroupName, strUserName, @LOCALGROUP)Every time I try to use the account WinNT displays a message telling me that the account has expired, but when I look in User Manager there is no mark in the checkbox 'Account expired'. Do anyone of you see my mistake?Answer:
You can only use the "flags" parameter once. The last value set wins.I think you want...
wntUserAddDat("name", strUserName) wntUserAddDat("password", strUserPwd) wntUserAddDat("usr_comment", "") wntUserAddDat("flags", 1 + 65536 ) wntUserAdd("")
Article ID: W13582Filename: wntUser... and Update User Accounts.txt