LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get Computer Name

Highlighted
I think there was a VI
'Get computer name'
somewhere in the GToolbox (or former LVutil).
I cannot find it - any hints?

I need the name of the computer the program works on because it
communicates with another application via TCP/IP and I would like to set
the standard application adress as the local PC.

Thanks
Urs Bögli
0 Kudos
Message 1 of 12
(14,568 Views)
Highlighted
Hello Urs,

An easy way is to use the "string to IP" wired to the "IP to string" VI (TCP palette). The IP to string function has a boolean input where you can define if you want to see the IP address or the machine name of the PC.

Regards,
Luca
Regards,
Luca
Message 2 of 12
(14,568 Views)
Highlighted
hello

See the attached vi
Hope it helps.
Alipio
---------------------------------------------------------
"Qod natura non dat, Salmantica non praestat"
---------------------------------------------------------
Message 3 of 12
(14,569 Views)
Highlighted
Luca,
that's fine, an easy solution but hard to find !

Attached is my VI now.

Thanks
Urs

Luca P. schrieb:

>Hello Urs,
>
>An easy way is to use the "string to IP" wired to the "IP to string"
>VI (TCP palette). The IP to string function has a boolean input where
>you can define if you want to see the IP address or the machine name
>of the PC.
>
>Regards,
>Luca
>
Message 4 of 12
(14,569 Views)
Highlighted
Alipio,
thanks for this solution. I think its disadvantge is the OS dependance.
Some target PCs are Win98, some Win2000.
The other solution mentioned seems to be independent of the platform and
is very easy to implement!
see other news
Urs

alipio schrieb:

>hello
>
>See the attached vi
>Hope it helps.
>Alipio
>
0 Kudos
Message 5 of 12
(14,569 Views)
Highlighted

This one worked nice!

 

0 Kudos
Message 6 of 12
(9,427 Views)
Highlighted

You could always use the system exec to run the command

 

IPCONFIG /ALL

 

Then parse the text for the Host Name

 

That would eliminate any Windows version poblems.

-------------------------------------------------------------------
Unfortunately, most readers of this Forum, including some real Experts, have not mastered the skill of being able to read the code that Posters fail to post. If we cannot see "what you did wrong", we are unable to tell you how to fix it. (Bob Schor 28 August 2018)
Message 7 of 12
(9,407 Views)
Highlighted

More than ten years later, Luca's solution is still very easy and has no Windows version problems. It looks like this :

 

Computer name.png

Message 8 of 12
(9,387 Views)
Highlighted

If you want more than just the computer name, you can use something like this.

"If you weren't supposed to push it, it wouldn't be a button."
Message 9 of 12
(9,351 Views)
Highlighted

But not such a good solution on Windows Server OS:

 

https://lavag.org/topic/19322-get-host-name-performance-issue/

 

-John
------------------------
Certified LabVIEW Architect
0 Kudos
Message 10 of 12
(7,900 Views)