KB-36259: Retrieving the computer’s name.

Question:

How can I retrieve the name of the computer running the application, at runtime?

Solution:

To do so, you must use the following script:

Set WshNetwork = CreateObject(“WScript.Network”)
MsgBox WshNetwork.ComputerName
‘MsgBox WshNetwork.UserDomain
‘MsgBox WshNetwork.UserName

With this script, you can also get the name of the user logged in, as well as the Domain where they are logged to.


NOTE
: with version 3.5 or higher, you can also use E3Globals‘s GetComputerName() method, which performs this exact same task.

Example: MsgBox GetComputerName()

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *