Sign in to follow this  
Followers 0
strate

Network Computer Names

13 posts in this topic

Is it possible to get the computer names off of a network? Search didn't help to much even after reading the topic started recently about how to search.


INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

Share this post


Link to post
Share on other sites



I'm not sure about the network part, but I know there's a Dll function in kernel32.dll that is called GetComputerNameA (or ExA, or ExW, or W). Look them up if you don't get any other options.

Share this post


Link to post
Share on other sites

I'm not sure about the network part, but I know there's a Dll function in kernel32.dll that is called GetComputerNameA (or ExA, or ExW, or W). Look them up if you don't get any other options.

I searched out your suggestion:

http://msdn.microsoft.com/library/default....omputername.asp

this can be done with @ComputerName though, unless I'm mistaken.


INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Is it possible to get the computer names off of a network? Search didn't help to much even after reading the topic started recently about how to search.

In the cmd shell, it's just:

rem View machines in my workgroup or domain
net view /domain

rem View machines in a named workgroup or domain
rem   (Note either a workgroup or domain is listed the same way)
net view /domain:MyWkGrp

rem Save results to a file
net view /domain:MyDomain > MyDomList.txt

The net view command works on NetBIOS (WINS) names, if you meant ActiveDirectory groups, DNS, or something else, you'll have to be more specific.

EDIT: Corrected first net view example

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

True, didn't see that macro....

So you're trying to get the names of the other computers without having any sort of script on the remote computer....

I was thinking you could do something like.. GetComputerName ($computer), but that's not how that works.

Share this post


Link to post
Share on other sites

True, didn't see that macro....

So you're trying to get the names of the other computers without having any sort of script on the remote computer....

I was thinking you could do something like.. GetComputerName ($computer), but that's not how that works.

What I'm doing is makin it easier for the user to use an application I'm working on. I know I remember computer names better than I do IP addresses. I want the list to be entered into a drop down box, but thats the easy part.

INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

Share this post


Link to post
Share on other sites

In the cmd shell, it's just:

rem View machines in my workgroup
net view

rem View machines in a named workgroup or domain
rem   (Note either a workgroup or domain is listed the same way)
net view /domain:MyWkGrp

rem Save results to a file
net view /domain:MyDomain > MyDomList.txt

The net view command works on NetBIOS (WINS) names, if you meant ActiveDirectory groups, DNS, or something else, you'll have to be more specific.

I don't think are network here at work liked that or I screwed something up.

Microsoft Windows XP [Version 5.1.2600]© Copyright 1985-2001 Microsoft Corp.

C:\>net view /domain:MyDomain > MyDomList.txt

System error 6118 has occurred.

The list of servers for this workgroup is not currently available

C:\>


INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

Share this post


Link to post
Share on other sites

What is this application going to do? If it involves having two computers talk to each other, that means they will both have the script (or at least part of it), right? So you could just tell one script to ask the other script what the computer name is, and have it send the name back. Maybe?

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

What is this application going to do? If it involves having two computers talk to each other, that means they will both have the script (or at least part of it), right? So you could just tell one script to ask the other script what the computer name is, and have it send the name back. Maybe?

What is, is the PC Control script (by Zerocool) that I'm modifying. It will just communicate between the two scripts and a FTP file.

Your idea crossed my mind:

Each "client" will add its computer name to a file on the internet. Then the "Server" script will read the list of active computers into the drop down box. Giving the server script a list of remote computers that are turned on.

Actually after thinking about it thats a really good idea. I'm going to go with that.

EDIT: Typos

Edited by strate

INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

Share this post


Link to post
Share on other sites

One more suggestion: include the IP with the computer name, just in case. Like: "Now Online: Computer1 (xxx.xxx.xxx.xxx)"

You get the idea.

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

One more suggestion: include the IP with the computer name, just in case. Like: "Now Online: Computer1 (xxx.xxx.xxx.xxx)"

You get the idea.

Sure can, not like its much more work anyways. Anything else that may be useful?

Edit:

@IP....1 thru 4 or just 1?

Edited by strate

INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

Share this post


Link to post
Share on other sites

Well, I'd go with 1. It's usually the standard, although there are lots of other possibilities (1-4 + _getip() ). @IPAddress1 is usually the actual computer's ip... and unless you can't connect using that IP, that's all that is necessary.

Share this post


Link to post
Share on other sites

I don't think are network here at work liked that or I screwed something up.

Microsoft Windows XP [Version 5.1.2600]
© Copyright 1985-2001 Microsoft Corp.

C:\>net view /domain:MyDomain > MyDomList.txt
System error 6118 has occurred.

The list of servers for this workgroup is not currently available

C:\>
If NetBIOS is running on your network, you would need to to substitute the name of your workgroup or domain for 'MyDomain'. If the name of your workgroup or domain was 'WIDGETS' the command would be:

REM List machines in workgroup or domain WIDGETS
net view /domain:WIDGETS > MyDomList.txt

The system error 6118 can also be caused by the browser service not running, in other words you are not using NetBIOS WINS naming at all. Sounds from other posts like you found a different solution anyway, but I wanted to clarify that and correct a mistake in my original post. To get a list of NetBIOS names in the workgroup or domain your machine is currently a member of, just use the '/domain' switch without giving a name:

REM List machines your current workgroup or domain by default
net view /domain > MyDomList.txt

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0