/build/static/layout/Breadcrumb_cap_w.png

MSI installation, get "Full Domain Name" from the registry

Hi

I'm trying to read out the "Full Domain Name" from the server during an installation. And put this into the registry. I have tried to do this from the registry and I have tried to find a property that can do this for me. Other properties like [ComputerName], [INSTALLDIR], [CommonAppDataFolder] etc.. works greate, but I can't seem to find a property that can give me the full domain name.

Anyone with some experience on this?

Regards S

0 Comments   [ + ] Show comments

Answers (8)

Posted by: timmsie 14 years ago
Fourth Degree Brown Belt
0
There isn't a windows installer property for this.

You could use the USERDOMAIN environment variable [%USERDOMAIN]
Posted by: mekaywe 14 years ago
Brown Belt
0
You can achieve this task using VBScript
Posted by: anonymous_9363 14 years ago
Red Belt
0
I *think* the OP is after the fully-qualified domain name, e.g. ourdomain.ourcompanyname.com: USERDOMAIN only contains the 'ourdomain' part.

@OP, if I'm right, you need to look at some AD interrogation script. Go to the computerperformance site, where there are many AD scripts.
Posted by: sabelotodo 14 years ago
Senior Yellow Belt
0
Hi guys, thank you for all your replies.

VBScab, you were right I meant the full-qualified domain name, and timmsie I could almost use the [%USERDNSDOMAIN], but the installation prosess is done under "Local System Account" so its not part of the domain.
I will digg a little deeper and post the result if I get it to work:-)

have a nice day!
Posted by: anonymous_9363 14 years ago
Red Belt
0
I'm feeling generous today...Public blnResult
Public strDomain
Public strFQDomain
Public objRootDSE

blnResult = BindToAD
If Not blnResult Then
WScript.Quit(False)
End If

Function BindToAD()
Dim blnResult_Bind

BindToAD = False

On Error Resume Next
Set objRootDSE = GetObject("LDAP://RootDSE")
If (Err.Number <> 0) Then
Exit Function
End If

strDomain = objRootDSE.Get("DefaultNamingContext")
If (Err.Number <> 0) Then
Exit Function
End If

'// Shouldn't ever be true if no error was returned, but...
If Len(strDomain) = 0 Then
Exit Function
End If

blnResult_Bind = GetFQDNFromNamingContext(strDomain, strFQDomain)
If blnResult_Bind Then
BindToAD = True
Else
If (Err.Number <> 0) Then
Exit Function
End If
End If

On Error Goto 0
End Function


'// ---------------------------------------------------------------------------------
'// GetFQDNFromNamingContext
'// Purpose: Converts a Naming Context into a DNS name
'// Input: strNamingContext e.g. DC=Domain,DC=Company,DC=com
'// Output: FQDN for strNamingContext e.g. Domain.Company.com
'// Returns: True/False
'//
'// Notes: LDAP allows for commas in strings, as long as they are escaped with a \ character.
'// e.g. "CN=Lewis\, Chris"
'// Since commas are not allowed in domain names, there is no parsing for them here.
'// ---------------------------------------------------------------------------------
Function GetFQDNFromNamingContext(ByVal strNamingContext, ByRef strFQDN)
Dim arrDomain
Dim intCount
Dim strTemp

GetFQDNFromNamingContext = False

'// Parse the NC by creating an array with the comma as an array boundry
arrDomain = Split(strNamingContext, ",")

For intCount = 0 To UBound(arrDomain)
'// Add a "." if needed
If Len(strTemp) > 0 Then
strTemp = strTemp & "."
End If

'// Remove the "DC=" and add this item to the temp string
strTemp = strTemp & Mid(arrDomain(intCount), 4)
Next

strTemp = Replace(strNamingContext,"DC=","")
strTemp = Replace(strTemp,",",".")

'// Return the FQDN
GetFQDNFromNamingContext = True
strFQDN = strTemp
End Function
Posted by: sabelotodo 14 years ago
Senior Yellow Belt
0
Thank you very much VBScab :-)
Have tried to add this script as an "Call VBScript From Embedded Code" during the Installation Sequence in Wise (Windows Installer Editor). But not sure how to get the output FQDN to use during the installation.

S
Posted by: anonymous_9363 14 years ago
Red Belt
0
- Add a property to the package called, say, FQDN.
- Assign it a nonsense value, say, NOWHERE.COM.
- In the script, add a check for the FQDN string not being empty. If it is, exit the script. If it's populated, use the Session object's Property method to assign the value to property FQDN:Session.Property("FQDN") = strFQDomain
- You can now use the property FQDN in the installation.
Posted by: sabelotodo 14 years ago
Senior Yellow Belt
0
Greate, I will give it a shot.

thank you very much for all the help[:)]

Have a nice day

S
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ