How to capture NT Workstation's domain name to a text file

sammy

Distinguished
Apr 7, 2004
90
0
18,630
Archived from groups: microsoft.public.windowsnt.misc (More info?)

I need to write a batch file to capture a few environment
variables when a NT domain 4 user logs on a Windows NT 4
station.

One of the variables that I do not know how to capture is
the domain that the NT machine belongs to.

Please help.

Thanks

Sammy
 
G

Guest

Guest
Archived from groups: microsoft.public.windowsnt.misc (More info?)

"Sammy" <anonymous@discussions.microsoft.com> wrote in message news:<12d4e01c4432e$0f0e2b80$a501280a@phx.gbl>...
> I need to write a batch file to capture a few environment
> variables when a NT domain 4 user logs on a Windows NT 4
> station.
>
> One of the variables that I do not know how to capture is
> the domain that the NT machine belongs to.
>
> Please help.
>
> Thanks
>
> Sammy

at the end of the login batch file this line will write the domain

Set userdomain >> c:\Yourfile.txt
 
G

Guest

Guest
Archived from groups: microsoft.public.windowsnt.misc (More info?)

ajames54 wrote:
>
> "Sammy" <anonymous@discussions.microsoft.com> wrote in message news:<12d4e01c4432e$0f0e2b80$a501280a@phx.gbl>...
> > I need to write a batch file to capture a few environment
> > variables when a NT domain 4 user logs on a Windows NT 4
> > station.
> >
> > One of the variables that I do not know how to capture is
> > the domain that the NT machine belongs to.
> >
> > Please help.
> >
> > Thanks
> >
> > Sammy
>
> at the end of the login batch file this line will write the domain
>
> Set userdomain >> c:\Yourfile.txt

Small technicality. Given the environment variable's name, does that
actually capture the domain that the machine belongs to, or the domain
that the user logged into. They can be different if the machine belongs
to a domain that has a trust with another domain.

You can probably parse nbtstat -n with the for command and/or findstr to
find the machine's domain.

hth
--
Ricardo M. Urbano
Microsoft Windows 2000/NT MVP