This concerns a logon-script, which assigns drive letters to network
drives, like in

WshNetwork.MapNetworkDrive "E:", "\\server-x\Public"

The problem is that not all servers (rather peers) are not always
switched on, and trying to map drives to those computers results in
long wait times and eventually invalid drive mappings.

But the WshNetwork object offers me -- as far as I can find out --
no means to verify first, if the target computer is actually
reachable.

I would like to have a method which enumerates all computers which
are currently logged on in a domain, or searching computers on the LAN
generally, as the "Search computer" menu item in "Network
Neighbourhood" (or how that is called in english).

Is that possible and can anybody point me to some way to do that,
please?


Cheers,
L.W.

Re: Searching computers on the net, and finding which is online by Pegasus

Pegasus
Thu Jun 26 06:01:36 CDT 2008


"Lüko Willms" <l.willms@domain.invalid> wrote in message
news:czd2LKcn8EGd-pn2-PS7yeHcwd5R9@lueko.willms.dialin.t-online.de...
>
> This concerns a logon-script, which assigns drive letters to network
> drives, like in
>
> WshNetwork.MapNetworkDrive "E:", "\\server-x\Public"
>
> The problem is that not all servers (rather peers) are not always
> switched on, and trying to map drives to those computers results in
> long wait times and eventually invalid drive mappings.
>
> But the WshNetwork object offers me -- as far as I can find out --
> no means to verify first, if the target computer is actually
> reachable.
>
> I would like to have a method which enumerates all computers which
> are currently logged on in a domain, or searching computers on the LAN
> generally, as the "Search computer" menu item in "Network
> Neighbourhood" (or how that is called in english).
>
> Is that possible and can anybody point me to some way to do that,
> please?
>
>
> Cheers,
> L.W.

The easiest way is to do both the check and the share connection
in a batch file:
@echo off
ping server-x -n 1 | find /i "bytes=" > nul && net use E:
"\\server-x\Public"

By the way, it is not a good idea to map drive E: to a network share.
With the increasing popularity of USB mass storage devices, the
likelyhood of someone's PC using drive E: for a flash disk is high.
You should use the upper letters of the alphabet for network shares,
e.g. from drive L: onwards.



Re: Searching computers on the net, and finding which is online by Tom

Tom
Thu Jun 26 08:25:21 CDT 2008

On Jun 26, 3:04 am, "L=FCko Willms" <l.wil...@domain.invalid> wrote:
> This concerns a logon-script, which assigns drive letters to network
> drives, like in
>
> WshNetwork.MapNetworkDrive "E:", "\\server-x\Public"
>
> The problem is that not all servers (rather peers) are not always
> switched on, and trying to map drives to those computers results in
> long wait times and eventually invalid drive mappings.
>
> But the WshNetwork object offers me -- as far as I can find out --
> no means to verify first, if the target computer is actually
> reachable.
>
> I would like to have a method which enumerates all computers which
> are currently logged on in a domain, or searching computers on the LAN
> generally, as the "Search computer" menu item in "Network
> Neighbourhood" (or how that is called in english).
>
> Is that possible and can anybody point me to some way to do that,
> please?
>
> Cheers,
> L.W.

If this is in XP or above, there is a WMI solution to pinging a
machine found in the MS Technet Script Center examples ...

strMachines =3D "atl-dc-01;atl-win2k-01;atl-nt4-01;atl-dc-02"
aMachines =3D split(strMachines, ";")

For Each machine in aMachines
Set objPing =3D GetObject("winmgmts:
{impersonationLevel=3Dimpersonate}")._
ExecQuery("select * from Win32_PingStatus where address =3D '"_
& machine & "'")
For Each objStatus in objPing
If IsNull(objStatus.StatusCode) or objStatus.StatusCode<>0
Then
WScript.Echo("Computer " & machine & " is not reachable")
End If
Next
Next

If the machines run other OSs, there is also a solution that uses the
command line PING, as Pegasus illustrated, but that is wrapped in VBS
code. A copy can be found here:http://groups.google.com/group/
microsoft.public.windows.server.scripting/msg/be46f11523413f4e

Pinging a server does not guarantee it is operational, but it is valid
in all cases where the machine is turned on and functioning. The only
time it will fail is if it is on, but failed in some other way. In
such cases, it might respond to a ping, but fail to service other
requests - probably a low percentage likelihood.

Tom Lavedas
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
http://members.cox.net/tglbatch/wsh/

Re: Searching computers on the net, and finding which is online by Willms

Willms
Thu Jun 26 09:36:41 CDT 2008

Am Thu, 26 Jun 2008 13:25:21 UTC, schrieb Tom Lavedas
<tglbatch@cox.net> auf microsoft.public.scripting.vbscript :

> If the machines run other OSs, there is also a solution that uses the
> command line PING, as Pegasus illustrated, but that is wrapped in VBS
> code. A copy can be found here:
> <http://groups.google.com/group/microsoft.public.windows.server.scripting/msg/be46f11523413f4e>


The latter looks good, especially because only one XP-machine is in
the net, the others run older versions of Windows. Thanks a lot.

Thanks also to Pegasus. BTW, the "E:" was copied from the
Microsoft's online manual for VBscript. In my logon script, the drive
letters start with "I:"


Cheers,
L.W.