I would like to read the Computer Name from the registry other than the SET
command to show %COMPUTERNAME%. Is there anyway to do it ? Which one is it
?
Thanks.
JW

Re: Computer Name by Al

Al
Sun Feb 08 22:13:47 CST 2004


"John Wood" <jwood@hotmail.com> wrote in message
news:5HDVb.14117$QX4.2700@clgrps13...
> I would like to read the Computer Name from the registry other than the
SET
> command to show %COMPUTERNAME%. Is there anyway to do it ? Which one is
it
> ?

Both methods are yucky. Why not do it this way:

Set WNO = CreateObject("Wscript.Network")
msgbox WNO.computername


/Al




Re: Computer Name by BlueFox

BlueFox
Mon Feb 09 03:22:32 CST 2004

Good idea!

"Al Dunbar [MS-MVP]" <alan-no-drub-spam@hotmail.com> дÈëÏûÏ¢
news:OtM5fMs7DHA.1592@TK2MSFTNGP10.phx.gbl...
>
> "John Wood" <jwood@hotmail.com> wrote in message
> news:5HDVb.14117$QX4.2700@clgrps13...
> > I would like to read the Computer Name from the registry other than the
> SET
> > command to show %COMPUTERNAME%. Is there anyway to do it ? Which one is
> it
> > ?
>
> Both methods are yucky. Why not do it this way:
>
> Set WNO = CreateObject("Wscript.Network")
> msgbox WNO.computername
>
>
> /Al
>
>
>



Re: Computer Name by Fosco

Fosco
Mon Feb 09 03:28:35 CST 2004

"John Wood"
> I would like to read the Computer Name from the registry other than the SET
> command to show %COMPUTERNAME%

'try :

set oShell = CreateObject("WScript.Shell")
bKey = oShell.RegRead("HKLM\System\CurrentControlSet\"& _
"Control\ComputerName\ComputerName\ComputerName")
sLogFile = "C:\COMP.LOG"
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oLogFile = oFSO.OpenTextFile(sLogFile, 8, True, 0)
oLogFile.WriteLine bKey
Wscript.Echo bKey


--
Fosco






Re: Computer Name by Ralph

Ralph
Mon Feb 09 05:32:38 CST 2004


Option Explicit

Dim WSHShell, RegKey, ComputerName

Set WSHShell = CreateObject("WScript.Shell")

RegKey =
"HKLM\System\CurrentControlSet\Control\Computername\ActiveComputerName\"

ComputerName = WSHShell.RegRead(RegKey & "Computername")

WScript.echo "ComputerName: " & ComputerName

' End code



On Sun, 8 Feb 2004 21:13:47 -0700, "Al Dunbar [MS-MVP]"
<alan-no-drub-spam@hotmail.com> wrote:

>
>"John Wood" <jwood@hotmail.com> wrote in message
>news:5HDVb.14117$QX4.2700@clgrps13...
>> I would like to read the Computer Name from the registry other than the
>SET
>> command to show %COMPUTERNAME%. Is there anyway to do it ? Which one is
>it
>> ?
>
>Both methods are yucky. Why not do it this way:
>
>Set WNO = CreateObject("Wscript.Network")
>msgbox WNO.computername
>
>
>/Al
>
>


Re: Computer Name by John

John
Mon Feb 09 08:59:01 CST 2004

Thanks

"Ralph Klos" <rklos@xs4all.be> wrote in message
news:8ure20l5ukp04s24bh4e09d9ltebb3k75v@4ax.com...
>
> Option Explicit
>
> Dim WSHShell, RegKey, ComputerName
>
> Set WSHShell = CreateObject("WScript.Shell")
>
> RegKey =
> "HKLM\System\CurrentControlSet\Control\Computername\ActiveComputerName\"
>
> ComputerName = WSHShell.RegRead(RegKey & "Computername")
>
> WScript.echo "ComputerName: " & ComputerName
>
> ' End code
>
>
>
> On Sun, 8 Feb 2004 21:13:47 -0700, "Al Dunbar [MS-MVP]"
> <alan-no-drub-spam@hotmail.com> wrote:
>
> >
> >"John Wood" <jwood@hotmail.com> wrote in message
> >news:5HDVb.14117$QX4.2700@clgrps13...
> >> I would like to read the Computer Name from the registry other than the
> >SET
> >> command to show %COMPUTERNAME%. Is there anyway to do it ? Which one
is
> >it
> >> ?
> >
> >Both methods are yucky. Why not do it this way:
> >
> >Set WNO = CreateObject("Wscript.Network")
> >msgbox WNO.computername
> >
> >
> >/Al
> >
> >
>



Re: Computer Name by John

John
Mon Feb 09 08:59:14 CST 2004

Thanks.

"Fosco" <fake@fake.invalid> wrote in message
news:7pIVb.280266$_P.9653953@news4.tin.it...
> "John Wood"
> > I would like to read the Computer Name from the registry other than the
SET
> > command to show %COMPUTERNAME%
>
> 'try :
>
> set oShell = CreateObject("WScript.Shell")
> bKey = oShell.RegRead("HKLM\System\CurrentControlSet\"& _
> "Control\ComputerName\ComputerName\ComputerName")
> sLogFile = "C:\COMP.LOG"
> Set oFSO = CreateObject("Scripting.FileSystemObject")
> Set oLogFile = oFSO.OpenTextFile(sLogFile, 8, True, 0)
> oLogFile.WriteLine bKey
> Wscript.Echo bKey
>
>
> --
> Fosco
>
>
>
>
>



Re: Computer Name by Al

Al
Mon Feb 09 22:29:52 CST 2004


"Fosco" <fake@fake.invalid> wrote in message
news:7pIVb.280266$_P.9653953@news4.tin.it...
> "John Wood"
> > I would like to read the Computer Name from the registry other than the
SET
> > command to show %COMPUTERNAME%
>
> 'try :
>
> set oShell = CreateObject("WScript.Shell")
> bKey = oShell.RegRead("HKLM\System\CurrentControlSet\"& _
> "Control\ComputerName\ComputerName\ComputerName")
> sLogFile = "C:\COMP.LOG"
> Set oFSO = CreateObject("Scripting.FileSystemObject")
> Set oLogFile = oFSO.OpenTextFile(sLogFile, 8, True, 0)
> oLogFile.WriteLine bKey

also:

oLogFile.close

/Al

> Wscript.Echo bKey
>
>
> --
> Fosco
>
>
>
>
>