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

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
There isn't a windows installer property for this.

You could use the USERDOMAIN environment variable [%USERDOMAIN]
Answered 01/25/2010 by: timmsie
Fourth Degree Brown Belt

Please log in to comment
0
You can achieve this task using VBScript
Answered 01/25/2010 by: mekaywe
Brown Belt

Please log in to comment
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.
Answered 01/25/2010 by: VBScab
Red Belt

Please log in to comment
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!
Answered 01/25/2010 by: sabelotodo
Senior Yellow Belt

Please log in to comment
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
Answered 01/26/2010 by: VBScab
Red Belt

Please log in to comment
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
Answered 01/27/2010 by: sabelotodo
Senior Yellow Belt

Please log in to comment
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.
Answered 01/27/2010 by: VBScab
Red Belt

Please log in to comment
0
Greate, I will give it a shot.

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

Have a nice day

S
Answered 01/27/2010 by: sabelotodo
Senior Yellow Belt

Please log in to comment
Answer this question or Comment on this question for clarity