Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.


Go Back   Vista Forums > Misc Newsgroups > VB Script

RB

Vista - How to get the Local Machine Name

Reply
 
08-26-2008   #1


xp
 
 

How to get the Local Machine Name

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

My System SpecsSystem Spec
08-26-2008   #2
Richard Mueller [MVP]


 
 

Re: How to get the Local Machine Name

adialji wrote:
Quote:

> 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
>
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
--


My System SpecsSystem Spec
08-26-2008   #3


xp
 
 

Re: How to get the Local Machine Name

But i am getting the error message
ActiveX component can't create object: 'Wscript.Network'
My System SpecsSystem Spec
08-26-2008   #4
Pegasus \(MVP\)


 
 

Re: How to get the Local Machine Name


"adialji" <guest@xxxxxx-email.com> wrote in message
news:53a528110837b568106e892f79d4d814@xxxxxx-gateway.com...
Quote:

>
> But i am getting the error message
> ActiveX component can't create object: 'Wscript.Network'
>
>
> --
> adialji
Here is another method:
set oWshShell = CreateObject("WScript.Shell")
wscript.echo oWshShell.ExpandEnvironmentStrings("%ComputerName%")


My System SpecsSystem Spec
08-26-2008   #5


xp
 
 

Re: How to get the Local Machine Name

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 !!
My System SpecsSystem Spec
08-26-2008   #6


xp
 
 

Re: How to get the Local Machine Name

How can i get the computer machine name from system registry?
My System SpecsSystem Spec
08-27-2008   #7
Al Dunbar


 
 

Re: How to get the Local Machine Name


"adialji" <guest@xxxxxx-email.com> wrote in message
news:2cdaeed89141aec0f18b490a4b06a639@xxxxxx-gateway.com...
Quote:

>
> 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 !!
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


My System SpecsSystem Spec
Reply

RB


Thread Tools


Similar Threads for: How to get the Local Machine Name
Thread Forum
create Ad user on local machine PowerShell
login to local machine Vista account administration
Add local machine users to local admin group via GPO .NET General
cannot copy files onto local machine Vista installation & setup
cannot copy files onto local machine Vista installation & setup


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd