How to get available active directory domain in the network using WIX?

658 Views Asked by At

I am developing a WIX installer. Set up requires active domain name as input while installation on a click of a button say "Browse". I googled a lot but found no way to implement. Please help to implement the same or suggest some other way to achieve this. Thanks.

1

There are 1 best solutions below

0
On BEST ANSWER

Here is a high level outline of how to do what you want.

Create your dialog that will have the browse button. (Dialog Parent) Create your dialog that will display the list of domains (Dialog Child) Configure your Publish elements (ControlEvents) on the Dialog Parent Browse Button to spawn the Child dialog.

Create a custom action in C++ or C# that queries Windows API's to get a list of domain the forest. Use Windows Installer API's to populate temporary rows into the ListBox table. This table will be used the ListBox control on the Child dialog. You may need to use an EnsureTable element to make sure the ListBox table gets created.

In C# you can read how to get a list of domains here: How to get a list of all domains?

To learn about temporary records look at my blog here: Dynamic Windows Installer UI

Schedule the custom action to run in the UI sequence after AppSearch. Build and test.

Here's how it works. The installer starts and runs the CA. The CA gets a list of domains and inserts temporary rows into the ListBox table as if they were authored at build time. The user gets to dialog parent and clicks the browse button. The child dialog is spawned (modal on top) and displays the list of domains. They select a record and the value associated with the record is set to the property associated with the ListBox. They click OK then Next and go about their merry way. Later you use the property somewhere like a Registry entry by saying [SELECTEDDOMAIN] or whatever else you called the property.

Since we are talking about properties with user configuration data, now is a good time to mention:

The WiX toolset's "Remember Property" pattern

This is the most detailed answer I can provide without doing the work for you. Additional assistance is available at an hourly rate.