# Computer Name

**URL:** <https://www.ruby-forum.com/t/computer-name/93780>\
**Category:** Rails\
**Created:** [April 10, 2006, 12:01am UTC](https://www.ruby-forum.com/t/computer-name/93780 "2006-04-10T00:01:04Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![lantis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/4da419/32.png) [@lantis](https://www.ruby-forum.com/u/lantis)\
**Post date:** [April 10, 2006, 12:01am UTC](https://www.ruby-forum.com/t/computer-name/93780/1 "2006-04-10T00:01:04Z")

</div>

How to get the name of the computer accessing the application? I mean  
the computer the user use to access the application.

Thanks,

Lantis.

---

<div class="post-metadata">

**Author:** ![lantis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/4da419/32.png) [@lantis](https://www.ruby-forum.com/u/lantis)\
**Post date:** [April 10, 2006, 6:39am UTC](https://www.ruby-forum.com/t/computer-name/93780/2 "2006-04-10T06:39:23Z")

</div>

> > > > > “Lantis” == Lantis S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

> How to get the name of the computer accessing the application? I mean  
> the computer the user use to access the application.

## Generally speaking you don’t, because there is no such thing as _the_ name of a computer. What are you really after?

```
	     Calle D. <removed_email_address@domain.invalid>
	 http://www.livejournal.com/users/cdybedahl/
   "Facts are for people with weak opinions." -- Lars Willför, I]M

```

---

<div class="post-metadata">

**Author:** ![lantis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/4da419/32.png) [@lantis](https://www.ruby-forum.com/u/lantis)\
**Post date:** [April 10, 2006, 4:38pm UTC](https://www.ruby-forum.com/t/computer-name/93780/3 "2006-04-10T16:38:01Z")

</div>

Calle D. wrote:

> > > > > > “Lantis” == Lantis S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:
> 
> > How to get the name of the computer accessing the application? I mean  
> > the computer the user use to access the application.
> 
> ## Generally speaking you don’t, because there is no such thing as _the_ name of a computer. What are you really after?
> 
> ```
> Calle D. <removed_email_address@domain.invalid>
> http://www.livejournal.com/users/cdybedahl/
> "Facts are for people with weak opinions." -- Lars Willfï¿½r, I]M
> 
> ```

I am developing some sort of web-based problem reporting system. If  
someone has a problem with a software, he will log on to the system and  
reports the problem. I want the system to get the computer name used to  
log the problem. In windows, right click my computer and click the  
computer name tab. The computer name i want to get is the full computer  
name; in my case is lantis-same.

Thanks,

Lantis.

---

<div class="post-metadata">

**Author:** ![lantis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/4da419/32.png) [@lantis](https://www.ruby-forum.com/u/lantis)\
**Post date:** [April 10, 2006, 4:39pm UTC](https://www.ruby-forum.com/t/computer-name/93780/4 "2006-04-10T16:39:29Z")

</div>

I forgot to add that the system is going to be used in windows  
environment only.

Lantis.

---

<div class="post-metadata">

**Author:** ![lantis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/4da419/32.png) [@lantis](https://www.ruby-forum.com/u/lantis)\
**Post date:** [April 10, 2006, 5:44pm UTC](https://www.ruby-forum.com/t/computer-name/93780/5 "2006-04-10T17:44:35Z")

</div>

Recording the ip address of the computer the request is coming from  
should be sufficient, provided they are fixed IP addresses.

On Monday, April 10, 2006, at 4:50 PM, Harm de Laat wrote:

> > Lantis.
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

\_Kevin

---

<div class="post-metadata">

**Author:** ![lantis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/4da419/32.png) [@lantis](https://www.ruby-forum.com/u/lantis)\
**Post date:** [April 10, 2006, 4:52pm UTC](https://www.ruby-forum.com/t/computer-name/93780/6 "2006-04-10T16:52:02Z")

</div>

I don’t think you can do this.  
It might be possible by using some VBScript / ActiveX component.  
However,  
this would require the user to allow Active X components.

---

<div class="post-metadata">

**Author:** ![lantis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/4da419/32.png) [@lantis](https://www.ruby-forum.com/u/lantis)\
**Post date:** [April 10, 2006, 9:13pm UTC](https://www.ruby-forum.com/t/computer-name/93780/7 "2006-04-10T21:13:30Z")

</div>

nbtstat -A | grep \<03\> | cut -f1 -d" "

if you are using windows and have grep and sed. There are windowy  
ways of greping and cuting too.

> From inside RoR I have to assume there is some way to execute shell  
> commands. It’s not pretty, but your only choice in this case I think

Alternatively, you could have a scheduled process run through all your  
sessions and look up computer names in the background and update a  
table in the database with them.

This is perishable data due to DHCP and user hijinx.

- Ian

---

<div class="post-metadata">

**Author:** ![lantis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/4da419/32.png) [@lantis](https://www.ruby-forum.com/u/lantis)\
**Post date:** [April 10, 2006, 7:35pm UTC](https://www.ruby-forum.com/t/computer-name/93780/8 "2006-04-10T19:35:27Z")

</div>

> > > > > “Lantis” == Lantis S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

> If someone has a problem with a software, he will log on to the  
> system and reports the problem. I want the system to get the  
> computer name used to log the problem. In windows, right click my  
> computer and click the computer name tab.

## There is nothing in standard web communication that will give you that. You can either log the IP adress of the incoming connection (and its reverse DNS, if there is one), or you can start investigating Windows-specific solutions.

```
	     Calle D. <removed_email_address@domain.invalid>
	 http://www.livejournal.com/users/cdybedahl/

```

“Do any churches offer gluten-free body of christ? Just in case some  
of  
their flock have problems digesting their saviour?” – Rob Blake,  
BofhNet

---

<div class="post-metadata">

**Author:** ![lantis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/4da419/32.png) [@lantis](https://www.ruby-forum.com/u/lantis)\
**Post date:** [April 11, 2006, 12:00am UTC](https://www.ruby-forum.com/t/computer-name/93780/9 "2006-04-11T00:00:24Z")

</div>

I’ll give it a shot. Thanks for the help.
