WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

wNT
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Determine if Computer is in a Workgroup or Domain

 Keywords:  Determine machine Computer Workgroup Domain

Question:

Anyone have some code to determine if the the computer is currently in a Workgroup or in a Domain and what the workgroup or domain name is? Specifically in the Windows 2000 environment. Any help is appreciated.

Answer:

Look up the wntLsaPolGet() function in the NT extender's help file. You want to get both elements #1 & #2 for the class "PrimaryDomain". Element #1 is the name of the domain or workgroup to which the computer belongs. Element #2 is the SID string for the domain; if this value is an empty string then the computer is part of a workgroup, and a non-empty string value indicates that the computer is part of a domain and the value of the string is the domain's SID string.
Article ID:   W15193
File Created: 2002:09:05:13:50:30
Last Updated: 2002:09:05:13:50:30