Using Javascript to grab the user's computer name

Hello all,

I'm trying to write a piece of javascript to get the client's computer name.
This is what I have so far...

<html>
<head>
<title>Javascript test</title>
<script language="JavaScript" type="text/javascript">
var strComputerName
{
var WshNetwork = new ActiveXObject("WScript.Network");
strComputerName = WshNetwork.ComputerName;
}

alert(strComputerName)

</script>
</head>

<body>

This should run the script

</body>
</html>

But I'm getting the follwoing error message: "Automation server can't create object."

Does anyone know what's up with that?
Thanks,
Maurice
LVL 2
GRCHELPDESKAsked:
Who is Participating?
 
ThaSmartUnoCommented:
0
 
GRCHELPDESKAuthor Commented:
Hello ThaSmartUno,

Thanks for the response... even if it's a little depressing.  :)
I found the code here, and it seems to be working for them.
Unless I'm mis-understanding something...

http://www.experts-exchange.com/Web/Q_21306539.html?query=javascript+%22computer+name%22&clearTAFilter=true
0
 
ThaSmartUnoCommented:
It works only on your own pc, if you run that from your browser located on your computer ...

on that Q they say "stand alone app" which im assuming means that it creates this web page on that computer and runs it.
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
GRCHELPDESKAuthor Commented:
So you're saying if I went to the server that's hosting this page, and ran it from there it would work?
Well... that's hardly ideal.

In your opinion, what's the way to accomplish this?  (assuming the exchange server isn't setup for reverse dns lookup)

Thanks!
0
 
ThaSmartUnoCommented:
Personally I have no idea what you could use.  I have had no reason to need to know a computer name so I can't really help you with that.  Sorry (I can search in little bit, but I'm just leaving work now so I won't be able to respond for about 30-40 min)
0
 
GRCHELPDESKAuthor Commented:
Thanks, I appreciate the effort.  If it can't be done, I'll have to figure something else out.  I guess I'll leave the question open for a bit in case someone has a work-around.

Thanks again!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.