Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to get the Local Machine Name

5,685 views
Skip to first unread message

adialji

unread,
Aug 26, 2008, 9:21:23 AM8/26/08
to

How to get the Local Machine Name of the Client.

If it is the WMI script which can help, then i am not able to create an
object for the WScript.Network Activex control.

Is there any other way to get the client machine name using the
vbcscript or the javascript. The wmi script can create object and get
the machine name using the .vbs file.

Can any one say me how to get the client machine name


--
adialji

Richard Mueller [MVP]

unread,
Aug 26, 2008, 9:38:55 AM8/26/08
to
adialji wrote:

The easiest method to retrieve the NetBIOS name of the local computer in
VBScript would be to use the wshNetwork object. For example:
=========
Set objNetwork = CreateObject("Wscript.Network")
strComputer = objNetwork.ComputerName

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


adialji

unread,
Aug 26, 2008, 10:29:17 AM8/26/08
to

But i am getting the error message
ActiveX component can't create object: 'Wscript.Network'


--
adialji

Pegasus (MVP)

unread,
Aug 26, 2008, 11:29:27 AM8/26/08
to

"adialji" <gu...@unknown-email.com> wrote in message
news:53a528110837b568...@nntp-gateway.com...

Here is another method:
set oWshShell = CreateObject("WScript.Shell")
wscript.echo oWshShell.ExpandEnvironmentStrings("%ComputerName%")


adialji

unread,
Aug 26, 2008, 12:04:51 PM8/26/08
to

I am actually using this vb script as

<script language = "vbscript">

set oWshShell = CreateObject("WScript.Shell")
wscript.echo oWshShell.ExpandEnvironmentStrings("%ComputerName%")

</script>

The moment this script gets executed at the client browser, an object
should be created to Wscript.Shell but i am getting the same error

" ActiveX Component Cant create object: 'Wscript.Shell' "

There Must be a way !!


--
adialji

adialji

unread,
Aug 26, 2008, 11:11:30 PM8/26/08
to

How can i get the computer machine name from system registry?


--
adialji

Al Dunbar

unread,
Aug 27, 2008, 12:03:00 PM8/27/08
to

"adialji" <gu...@unknown-email.com> wrote in message
news:2cdaeed89141aec0...@nntp-gateway.com...

It seems that your script is embedded in an html page, in which case wscript
is not available, as that belongs to the WSH (cscript/wscript) scripting
engines.

/Al


0 new messages