Log in

View Full Version : Displaying computer name ?



Mr Gear
06-28-2006, 04:57 PM
Hi

I've got some web pages on the Intranet at work which I'd like to 'enhance'.

Is in possible to display the local computer name to the user on a web page ?

i.e. the name that the local %computername% system variable would give ?

Thanks

Paul

serverextreme
06-28-2006, 05:06 PM
Hello I am not sure I completely understand your question

Mr Gear
06-28-2006, 05:52 PM
Hi

Ok, I'll try again....

All computers have their own name, i.e. the one set under
Control Panel | System Properties | Computer Name
(the one that can be displayed by entering echo %computername% from a command prompt)

I'm hoping there is a way that this can be read and displayed on a web page, basically so something very simple like "You are using computer WKSTN001" can be put on screen.

Does that help ?

Paul

Twey
06-28-2006, 05:55 PM
All computers have their own name, i.e. the one set under
Control Panel | System Properties | Computer Name
(the one that can be displayed by entering echo %computername% from a command prompt)(opens a terminal and tries it in zsh)
Nope :)

And there we have the problem: not all computers do have a "computer name." You could probably do something with ActiveX or Java, but other than that, it's not possible without making some adjustments to the browsers on each client machine.

djr33
06-29-2006, 06:40 AM
You might be able to base something off IP if you could set a group of relationships... Use an array where $array['someIP'] = "someComputer";
(this is php syntax... not too different than other languages though, though, aside from the $ for identifying variables.)

Note that I'm talking about local IP on the network... this would be harder (maybe impossible) to implement if you were doing something web based and wanted to identify the computer from within the network that was sending the information.

Is this for an intranet or the internet?

simonf
06-29-2006, 11:03 AM
With I.E try

<!-- Start of ActiveX -->
<Script language="javascript">
var oNetwork = new ActiveXObject("WScript.Network")
var sComputerName = oNetwork.ComputerName
alert(sComputerName);
</script>
<!-- End of ActiveX -->
Gives a pop up alert with the computer's name

Twey
06-29-2006, 02:59 PM
There we go :)

Note that since it's using ActiveX, it's IE/Win only, and it may pop up a warning alert if the server isn't in the "trusted" IE zone.

Mr Gear
06-29-2006, 04:11 PM
Thanks,

I'll give it a go when I'm back at work on Monday

(Friday off with this terrible weather we're having... :D )

Much appreciated

Paul