Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting NT username and Computer Name 1

Status
Not open for further replies.

Halucin8

Programmer
Aug 17, 2001
9
GB
Hia
I'm hoping someone can help me. I'm relatively new to Coldfusion and need a little advice. I want to automatically gather Windows NT Usernames and Computer Names, to save the users having to type them in. Does anybody know if you can do that in ColdFusion? I have seen how to do this in JavaScript but I'd rather do it in ColdFusion

Any help would be greatly appretiated.

 
Hey Halucin8,

Since CF runs on the server, there's no way for CF to know anything about the state of the visitor's PC except where you pass information to the script. When a CF script runs, the only information it has available comes from variables you pass to it and some cgi variables passed by the server and web browser. It's possible IE might pass additional Windows information but I would be surprised if it passed the username and password to any website.

I don't do a lot of JS scripting so I can't say how feasible this would be but JS would be the only way I see as a possibility.

Good luck,
GJ
 
Hey Halucin8,

If your network is running IIS and NT 4.0, try playing with the CGI variable #REMOTE_USER#. In Internet Service Manager, click on "Directory Security" and then the "edit" button by the "Anonymous Access and Authentication Control". If, on the next screen, you have "Allow Anonymous Access" UNCHECKED and "Basic Authentication" and "Windows NT Challenge/Response" both CHECKED, then your browser will pass the user's logon as this CGI variable. It should be in the form "domain/userlogon", like "quickestore/jhoarty". You can then do string manipulation to extract the username part. For example:

#RIGHT(REMOTE_USER, LEN(REMOTE_USER)-12)#

would extract "jhoarty" from REMOTE_USER in my example. John Hoarty
jhoarty@quickestore.com
 
PS Of course, you can only have this stuff AFTER they've already logged on, but I can't imagine you are wanting to save your users the burden of logging onto the network the first time. That would be kind of counterproductive. :cool: John Hoarty
jhoarty@quickestore.com
 
To JHorty & GunJack

The reason i wanted the username and machine name was because i'm working on a questionaire to find out what users want what software before an overhaul and i didn't want users to have to enter there own, It's just for information really, makes my life a little easier :) .
JHorty I have managed to get the username but the machine name still seems a mystery....

Thanks all for your help, it's most appreciated.

Tammyxx
 
For what it's worth, your machine name exists in your registry at

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ActiveComputerName

but I don't know how you go after it! If I turn up anything I'll certainly let you know. Good luck!

John Hoarty
jhoarty@quickestore.com
 
cheers John, i'll have a play around and see what i can find


Thanks for replying

Tammyxx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top