home *** CD-ROM | disk | FTP | other *** search
- // FINDALL.SCP Sample Script
- // Copyright (c) 2002, Vector Networks Limited
- // All Rights Reserved
- //
- // Revision History:
- // 7.0 29-Jan-02 DB - Created, using LOOKUP.SCP.
-
- // This is a simple script which can find all Clients in a
- // Group, find all Available Clients, or list all Known Clients.
- // For each Client found, it calls ProcessClient, which can
- // be modified to do whatever you want...
-
- // Predefined variables:
- // ClientName = "" Template name for Lookup (use "*" for any)
- // GroupName = "" Lists all Clients in this Group
- // Password = "GBBLLYDGKK" Encrypted password for remote network
- // Username = "SCRIPTING/GBBLLYDGKK" Username and password for Connect
-
- Function Main ()
- Dim ClientList, ClientCount, ClientTotal
- Dim CurClient, ClientName, GroupName, Username
-
- // Initialise counter variables
-
- ClientCount = 0
- ConnectErrors = 0
- TotalErrors = 0
-
- // Trim predefined variables before use
-
- ClientName = Trim (ClientName)
- GroupName = Trim (GroupName)
- Username = Trim (Username)
-
- SetTransport (T_TCPIP)
-
- // See what we are supposed to do
- // and get any Clients into a list
-
- If GroupName != "" Then
- Print "Selecting all Clients in Group: ", GroupName
- ClientTotal = GetClientsInGroup (GroupName, ClientList)
- Else
- If ClientName != "" Then
- Print "Browsing the Network for Clients. Please wait..."
- If ClientName = "*" Then
- ClientTotal = LookUp ("", ClientList)
- Else
- ClientTotal = LookUp (ClientName, ClientList)
- Endif
- Else
- Print "Listing all Known Clients"
- ClientTotal = GetAllClients (ClientList)
- Endif
- Endif
-
- If ClientTotal > 0 Then
- Print CStr (ClientTotal), " Clients found"
-
- // Now, work through the list of Clients
-
- ClientCount = 0
- ClientNum = 1
-
- For Each CurClient in ClientList
- ClientName = GetClientName (CurClient)
-
- If ProcessClient (CurClient, ClientName, Username) Then
- Print "Client ", ClientNum, " <", ClientName, "> processed successfully"
- ClientCount = ClientCount + 1
- Else
- Print "Client ", ClientNum, " <", ClientName, "> processing FAILED"
- TotalErrors = TotalErrors + 1
- EndIf
- ClientNum = ClientNum + 1
- Next
- Else
- Print "No Clients found"
- Endif
-
- // Print a summary
-
- Print ""
- Print "Summary:"
- Print " Total Clients ", ClientTotal
- Print " Clients found ", ClientCount
- Print " Total Errors ", TotalErrors
- End Function
-
- // ProcessClient is a generic Function which can be altered
- // to do almost anything on one Client.
-
- Function ProcessClient (CurClient, ClientName, Username)
- Print "Processing Client <", ClientName, ">"
-
- If Connect (CurClient, Username) == TRUE Then
- Print "Connected to ", ClientName
- Disconnect (CurClient)
- ProcessClient = TRUE
- Else
- Print "Unable to connect to ", ClientName
- Print "Error ", LASTERROR, " = ", LASTERRORSTRING
- ProcessClient = FALSE
- EndIf
- End Function
-