Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: w95getuser wntgetuser netname
This should be a simple job for WinBatch I thought, but I may have been wrong. WB can look at expire times, last logons etc, but I can't figure out a way to get the username that was used for the domain authentication. The only username I can find is for logon to the local machine.
Can this be done? The documentation regarding wntGetUser() doesn't really tell me much. It refers to "the network", but which parameters are acceptable? Could "the network" be NT domain names for instance?
Anyway - how come a query using "Netware Services" returns the WinNT logon name?
Since it is quite probable that you are not logging in to the NT domain then it is not likely that you will get password expiration notices for the user accounts in the domain. If the username/password on the local workstation is the same as the username/password in the domain then you get passthru authentication (sort of like an implicit trust) to the domain controllers. Thus, you can access shared file and printer shares on the domain controllers w/o having to logon to the domain. However, once your NDS password (and thus your local WinNT account password) has been changed, the domain account's password is now out of sync with the NDS account password. At this point you lose your passthru authentication and access to resources on the domain controllers will fail.
You could use the Win32 network extender to explicity interrogate your domain account to find out how soon the password expires. I do this quite often since my development WinNT/Win2K workstation is in a workgroup yet I use it to manage a WinNT server that is a PDC in its own domain. You will need to explicity identify the domain name when using the extender functions so that the domain SAM is accessed instead of the local workstation SAM.
I guess I'd get the correct answer if I could do this:
wntGetUser("Microsoft Windows Network\DOMAIN")Seems like using only "Microsoft Windows Network" returns the local machine account (the one created by Workstation Mananger).
Judging by your issues with determining the password expiration date, I'd have to guess that you are signed on to the local workstation with a local account. This can be done even if the workstation is part of a domain. As long as the credentials are the same as a domain account you can access resources on the domain controllers w/o logging on to the domain. Where you might have a problem is trying to access domain resources on member server (not a domain controller) in the domain.
There should be no question about what account was used to access domain resources. If the workstation is in a workgroup then domain resources were accessed via passthru authentication. If the workstation is part of the domain then you either used a local account with passtru authentication to the domain or you logged on to the domain with a domain account and accessed domain resources via the domain account. The environment variable "USERDOMAIN" and the environment variable "USERNAME" get defined upon a successful logon to the local workstation regardless of whether a local account or domain account was used to perform the local logon. This means that you can interrogate the environment variable "USERDOMAIN" and determine if it is a workstation name or a domain name. If it is a workstation name then you know that you are accessing domain resources on domain controllers via passthru authentication and that you need to explicitly check the password expiration date on the domain account.
Article ID: W14639
Filename: wXXGetUser and Netname.txt
File Created: 2000:10:05:11:07:42
Last Updated: 2000:10:05:11:07:42