JLavalley
Posts: 38
Joined: Tue Mar 03, 2009 7:28 pm

Detect Domain context

During my installer, a user is created. I need to know where that user is created (the local machine if the install is run on a Stand Alone or Member Server, and the domain if the install is run on a DC)?
I can get the computer name (COMPUTERNAME), but can't find a property with the domain name..

?
- Jerome
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Detect Domain context

Hello,

Please keep in mind that if the related user is created using our "Users and Groups" support, then it will always be created as a local account.

Also, if you are using a custom action to create the related user under a domain controller, then you should use your own custom action to get the domain name.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
JLavalley
Posts: 38
Joined: Tue Mar 03, 2009 7:28 pm

Re: Detect Domain context

Daniel,

Actually, on a domain controller there is no such thing as a "local account" so when a user is created using "Users and Groups", isn't it created as a domain user?

I am using "Users and Groups", but finding the domain that the current user is logged into would suffice. (%USERDOMAIN%).
- Jerome
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Detect Domain context

Hello,
Actually, on a domain controller there is no such thing as a "local account" so when a user is created using "Users and Groups", isn't it created as a domain user?
I'm afraid this is wrong. Please take a look on "Create Local User Accounts in Windows Server 2008" article. As I said in my previous post users created using our "Users and Groups" support will always be created as local accounts.
I am using "Users and Groups", but finding the domain that the current user is logged into would suffice. (%USERDOMAIN%).
Please keep in mind that the USERDOMAIN environment variable will be resolved to computer name for local accounts.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
JLavalley
Posts: 38
Joined: Tue Mar 03, 2009 7:28 pm

Re: Detect Domain context

I'm afraid this is wrong. Please take a look on "Create Local User Accounts in Windows Server 2008" article. As I said in my previous post users created using our "Users and Groups" support will always be created as local accounts.
..if a Windows server 2008 is configured as a member server..
I'm referencing a domain controller. A Windows 2008 Domain Controller. A domain controller does not have local accounts.
- Jerome
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Detect Domain context

Hello,

First of all I apologize for my wrong answer. Indeed, on a domain controller local accounts are disabled. Also, when running an installation package (which contain an user added in our "Users and Groups" page) on a domain controller, then the related user will be added as a domain user (tested on a Windows Server 2003 promoted as a domain controller).

So, in order to achieve what you want you can use the USERDOMAIN environment variable. Here's attached a sample which creates a "TestUser" user account and set (on "Custom Action" page) the MYPROP property to USERDOMAIN environment variable value.
sample.zip
(3.34 KiB) Downloaded 448 times
Let us know if you have any questions.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
JLavalley
Posts: 38
Joined: Tue Mar 03, 2009 7:28 pm

Re: Detect Domain context

We are getting closer.

My install adds a user..
After the user is created, I need to know the context that the user was created in so that I can update my configuration files with that information.

On a member server ("MEM1") the user is created in the local machine context, and I record the COMPUTERNAME variable: "MEM1"

On a domain controller ("DC1") the user is created in the domain ("DOMAIN").. I need to record "DOMAIN".

How can I tell where the user was created? Is there a property that tells me that the current machine is a domain controller?
- Jerome
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Detect Domain context

Hello,

I'm afraid there is no property which could contain this information. However, in order to achieve what you want you can create your own custom action which will search for computer role and will set a property accordingly. You can take a look on "How can I tell if my program is running on a Domain Controller?" article which could be useful for you.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”