Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Ideally I'd like to send a link via staff email that staff could click on to reveal their computer name. (Specifically first part of the 'Long computer name' found in the second tab of My Computer Properties.)

Is there some JavaScript/VBScript/ActiveX object on the client side, or CGI script on the server-side that can let a user know their computer name by returning a simple web page?

For good reasons the organisations stops users from downloading/running apps, so oneClick deploy and downloading batch files is out of the question with the existing infrastructure/policy setup.

Oh - it should work for the enterprise wide install of Internet Explorer 6/Windows XP that isn't likely to be updated anytime soon.

Answers

Via email

Send them a link for:

http://%computername%

This will bring up "Internet explorer cannot display the webpage" but the address bar will show the machine name.

Server Side

You want the REMOTE_HOST server variable. First enable reverse DNS on the web server. Then create a page to return the variable you want. Here it is in ASP.

<% Response.Write ServerVariables("REMOTE_HOST") %>
share|improve this question
    
Commenting as this does not involve using the broswer. This SF question has a novel way of displaying %COMPUTERNAME% instead of My Computer. Works on Windows XP also. –  jscott Aug 17 '10 at 16:41

7 Answers 7

up vote 1 down vote accepted

Send them a link for:

http://%computername%

This will bring up "Internet explorer cannot display the webpage" but the address bar will show the machine name.

or

They could run a bat file from their desktop:

echo %computername% >> c:\users\%username%\Desktop\computername.html
"c:\program files\internet explorer\iexplore.exe" c:\users\%username%\Desktop\computername.html
share|improve this answer

If this is Windows Only environment, your best bet will be OneClick deployment and simple c# (or vb.net) program which uses System.Environment.MachineName with or without combination with System.Net.Dns.GetHostByAddress for more information.

share|improve this answer

This should work as client-side VBScript:

Set ADSysInfo = CreateObject ("ADSystemInfo")
Set CurrentComp = GetObject ("LDAP://" & ADSysInfo.ComputerName)
ShortCompName = ADSysInfo.sAMAccountName

This implementation just gets the short name, without your domain appended; look in ADSIEdit or on TechNet or MSDN to get the full list of properites you can retrieve.

You might also need to do some jiggery-pokery in your intranet zone IE settings.

share|improve this answer

You want the REMOTE_HOST server variable. First enable reverse DNS on the web server. Then create a page to return the variable you want. Here it is in ASP.

<% Response.Write ServerVariables("REMOTE_HOST") %>

If you want to take a look at all the possible variables, use this

<%
for each x in Request.ServerVariables
  response.write(x  & ": " & Request.ServerVariables(x) & "<br />")
next
%>
share|improve this answer

This doesn't answer your question, but you might consider deploying Sysinternals BGInfo as part of your desktop image. This puts the name of the PC (and other relevant information you specify) right on the user's desktop background.

share|improve this answer
    
+1 good tip but not possible in this case. –  Stephen Jun 19 '09 at 20:57

Not really, no, the browser security is pretty much setup to prevent web servers from getting information like that.

I guess since you mention CGI is an option, if DNS updates where working perfectly, you might be able to write some kind of program that runs on an internal web server that looks up the reverse DNS record for the IP address that was used to connect and then returns that.

I suppose, you could store an HTA on a file server and send a UNC to the users.

share|improve this answer

Or client could open commandprompt and type "hostname" and hit enter. Or Start > Run > (Winkey+R) type: "cmd.exe /k hostname" and hit enter.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.