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...

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




This should run the script


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

Does anyone know what's up with that?
Who is Participating?
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...
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.
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)

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)
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!
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.