>>Any one know how to find out what PC are logged on to a network. I want to access data on them , but if they ae not present , the system hangs while it tris to find the network connection.
>>
>>Any ideas
>>
>>Brian
>
>I think the easiest way would be to use:
>
>
>Anetresources(laComputers, 'YourDomain', 1)
>
>
>You can also use LDAP or WMI, but if you only need the name of the computers, I would go with the native function.
Well I missed the hanging part. You can try to ping them before working with them (Only for Windows XP or +):
function Ping(tcTarget)
lparameters tcTarget
local lcTarget, loWMI, loPingStatus, llResponded
if Vartype(tcTarget) # 'C'
return .F.
endif
lcTarget = strtran(Alltrim(tcTarget), '\', '')
try
loWMI = GetObject("winmgmts:")
loPingStatus = loWMI.Get("Win32_PingStatus.Address='" + lcTarget + "'")
llResponded = loPingStatus.StatusCode = 0
catch
llResponded = .F.
endtry
return llResponded
So you can do something like:
local laComputers(1), lnComputers, lnComputer
lnComputers = Anetresources(laComputers, 'YourDomain', 1)
for lnComputer = 1 to lnComputers
if Ping(laComputers[lnComputer])
endif
next lnComputer
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?
"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare
"To die for a religion is easier than to live it absolutely"
Jorge L. Borges