Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to get all connected users in a network
Message
 
À
06/10/2010 03:00:09
Albert Beermann
Piepenbrock Service Gmbh & Cokg
Osnabrück, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Divers
Thread ID:
01484105
Message ID:
01484176
Vues:
69
>Hello Everybody
>We have a WAN with 1400 users in 100 different locations.
>
>I need a cursor with all connected users (username,connectiondate,time,ipadress)
>
>Reading Active Directory informations ???
>Any other way ???
>
>Short example would be great.
>
>Best regards
>Albert

Would this work?
local loConnection, loSessions, loSession

lcServer                = "<Your Server>"
loConnection            = GetObject("WinNT://" + lcServer + "/LanmanServer")
loSessions                = loConnection.Sessions()

create cursor C_Sessions ;
    ( ;
        PK                I         autoinc    , ;
        Computer        C(64)            , ;
        ConnectedTime    I                , ;
        IdleTime        I                , ;
        Name            C(64)            , ;
        User            C(64)              ;
    )

For Each loSession in loSessions
    wait window 'Adding: ' + loSession.Name nowait
    with loSession
        try
            insert into C_Sessions ;
                    (    ;
                        Computer                , ;
                        ConnectedTime            , ;
                        IdleTime                , ;
                        Name                    , ;
                        User                      ;
                    ) ;
                values ;
                    ( ;
                        .Computer                , ;
                        .ConnectTime            , ;
                        .IdleTime                , ;
                        .Name                    , ;
                        .User                      ;
                    )
        catch
        endtry
    endwith
endfor

wait window 'Creating indexes...' nowait

index on    PK            tag PK
index on    Computer    tag Computer
index on    Name        tag Name
index on    User        tag User

wait clear
"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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform