PDA

View Full Version : Create Windows User



konstantin
09-29-2010, 09:51 AM
We having problems creating a new windows account as part of the install. Here is what we do:

1. InstallScript MSI project type.
2. Included NetApiRT.obl (before isrt.obl) in build/settings.
3. Used the following as part of the script:

Dlg_SdLogon:
nResult = SdLogonUserInformation(szTitle, szMsg, szAccount, szPassword);
if (nResult = BACK) goto Dlg_SdAskDestPath;
OnLogonUserSetMsiProperties();

From what I can see, everything works properly, I can select a user or successfully fill in the information to create a new user. However, the new user doesn't get created.

Even more, further inversigation showed, that during the install process the user DOES get created and than quickly REMOVED again. Which makes me completely puzzled as to why would InstallShield remove the newly created account at the end of the installation...

Please, I need some guidance to allow users to successfully create (and use) a new windows account, belonging to user selected group...

As usual, the documentation is not very helpful, no practical information or working example found.

Thanks in advance
Konstantin

I understand that there are options to create a custom .NET dll, or call an external command line tool, but the IS build-in functionality should work, shouldn't it? Thus, I am really interested in how to get it to work using IS included functionality.

competent_tech
11-22-2010, 05:04 PM
We are experiencing an identical issue in an MSI project using the built-in LogonInformation dialog set. The frustrating thing is that it used to work (in 2010 and earlier versions), so I suspect that something has broken in NetAPI.

wrun44
04-19-2011, 04:30 PM
Did you ever find a way around this?

jwallenstein
04-20-2011, 02:55 AM
Hello,

we are still using Netapi functions to create user accounts.
It makes us free and we know exactly how it does work.
We are also free to set user information and flags.

Regards

Jan

wrun44
04-21-2011, 07:41 AM
Hi Jan,
Yes, it seems that we also need a custom dialog. Could you kindly advise where to start? I created InstallScript msi and imported the sample dialog script and see all needed NetApi calls there, but not sure how to call that (or similar) dialog from my Setup.rul - the dialog is not declared, and if I declare it, it is not seen from Setup.rul anyway, and that script file is #included. I'm missing something. I worked with custom dialogs before, but never used loaded dlls.

Regards,
Wrun.

wrun44
04-21-2011, 02:07 PM
OK, found my answers here http://community.installshield.com/archive/index.php?t-142448.html

(1) Do not add the... <ISProductFolder>\Script\ISRT\Lib\NetApiRT.obl
...statement in your Build->Settings->Link Libraries field.

(2) Take a copy of "NetApiRT.rul" file and insert it into your project. Make the necessary changes to the SdLogonUserInformation() function so that it doesn't call ISNetApiRT.ISNetValidateLogonName(...) under Win2K. Tip: you could also add a pop-up to confirm the password in Win2K, as it is not validated.

(3) Add #include <your path>\"NetApiRT.rul" to "Setup.rul".

(2) Add the #define statement... #define NETAPIRT_OBL to "Setup.rul"
...before your #include "ifx.h" statement and the #include "NetApiRT.rul".