Greetings,

Out of curiosity, what is the use case here? We don't have a command for
that - but if there is a compelling reason for same - I'm happy to lobby for
its inclusion!

 

Below is a function that will do this.  Only credit I can take for this is
adding the helpful comments and putting the code into a copy / paste
friendly form.

 

I got it from here.

http://www.codeproject.com/KB/vbscript/SystemUtility.aspx

 

Paste in the below into your Project

 

'This goes at the very tippy top of the module

Private Declare Function GetComputerName Lib "kernel32" Alias
"GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long

 

'This can go anywhere

 

Public Function GetTheComputerName() As String

Dim strComputerName As String ' Variable to return the path of computer name

    strComputerName = Space(250) ' Initilize the buffer to receive the
string

    GetComputerName strComputerName, Len(strComputerName)

    strComputerName = Mid(Trim$(strComputerName), 1,
Len(Trim$(strComputerName)) - 1)

    GetTheComputerName = strComputerName

End Function

      

 

Thom C. Blackwell

Product Manager

Boston Software Systems

(866) 653-5105 ex 807

www.bossoft.com <http://www.bossoft.com/> 

Sign <http://www.bostonworkstation.com/customer_center/special_events.aspx>
up for my weekly webinar!

 

LEGAL NOTICE Unless expressly stated otherwise, this message is confidential
and may be privileged. It is intended for the addressee(s) only. Access to
this E-mail by anyone else is unauthorized. If you are not an addressee, any
disclosure or copying of the contents of this E-mail or any action taken (or
not taken) in reliance on it is unauthorized and may be unlawful. If you are
not an addressee, please inform the sender immediately, then delete this
message and empty from your trash.

 

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mitchell Sherry - Mid
West Div.
Sent: Monday, August 04, 2008 2:29 PM
To: [email protected]
Subject: [Talk] Computer Name

 

Is there a command to capture the name of the computer running the script?

 

thanx,  Sherry

HCA Midwest Health Systems IT&S

Programmer/Analyst II

816/823-0406

"Some of us are more capable than others of us...but none of us is more
capable than all of us" Tom Wilson/Ziggy

 

Reply via email to