/build/static/layout/Breadcrumb_cap_w.png

Retrieve Primary Domain Controller in Wise

For a setup I am creating I am required to retrieve the end user's primary domain controller and place it in a property, so that is becomes the default value.

The catch is that I cannot use VBScript, WiseScript, or any other kind of script to grab it.

Is there any way I can call a DLL or something to pull the server name into a property?
e.g. netapi32.dll

I am a n00b when it comes to making calls to DLLs.

Thanks

0 Comments   [ + ] Show comments

Answers (11)

Posted by: bheers 18 years ago
Second Degree Blue Belt
0
you can use app search to get the a registry value under

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon

DefaultDomainName

and update a property.
Posted by: timmsie 18 years ago
Fourth Degree Brown Belt
0
You can also use the environment variable like this:

[%USERDOMAIN]


A useful page in the sdk for info like this is the "formatted" page
Posted by: OldWiseMan 18 years ago
Senior Yellow Belt
0
Thanks guys.

I forgot to mention that I tried the above, but I need the server name without the leading backslashes that are included in that environment variable.

Is it possible to exclude them without any scripting?
Posted by: timmsie 18 years ago
Fourth Degree Brown Belt
0
You'd have to parse them off with wise script or vb script.
The variable I included will give you the domain not the domain controller. Sorry I misread the question, I guess your using [%LOGONSERVER].

You can get the PDC by calling the netapi32.dll the function is NetGetDCName. But that's as far as I go with dll calls I'm afraid!!
Posted by: OldWiseMan 18 years ago
Senior Yellow Belt
0
Cool thanks.

One more question.

Is there any way to pass the output of a commandline application such as DSQUERY.EXE to a property?
Posted by: timmsie 18 years ago
Fourth Degree Brown Belt
0
Not as far as I know. The only way you could do it is if you can write the output of the command line utility to somewhere you can read it. e.g a reg key
Posted by: aogilmor 18 years ago
9th Degree Black Belt
0
If you're using Wise you can populate the Windows Installer property like so:
[%LOGONSERVER]
If I find a way to extract the backslashes without any kind of script, i'll let you know. Thanks!
Posted by: aogilmor 18 years ago
9th Degree Black Belt
0
I found a way to do it with an embedded VBscript. Not sure how one might do it via a a Windows API, but there's sure to be some way.

Let me know if you're interested.
Posted by: OldWiseMan 18 years ago
Senior Yellow Belt
0
Cheers lads.

In the end I got permission to use an embedded WiseScript to parse the environment variable to remove the "\\".
Posted by: aogilmor 18 years ago
9th Degree Black Belt
0
cheers mate [;)] i think your sol. is tighter actually (relies less on vbscript, which really kinda sux).

MSFT recommends agains vbscript in custom actions because you can't guarantee a roll back.
Posted by: Foleymon 18 years ago
Orange Senior Belt
0
This command will show you the PDC
'net time /domain:domainname'
you could pipe that into a .txt file

net time /domain:domainname >> c:\temp\PDCinfo.txt

and then parse that file to read the PDC into a variable.
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