Function Reference


_Net_Share_StatisticsGetSvr

Retrieves operating statistics for a server

#include <NetShare.au3>
_Net_Share_StatisticsGetSvr ( [$sServer = ""] )

Parameters

$sServer [optional] Specifies the DNS or NetBIOS name of the remote server on which the function is to execute.
If this parameter is blank, the local computer is used.

Return Value

Success: an array with the following format:
    [ 0] - Indicates the time when statistics collection started.
        The value is stored as the number of seconds that have elapsed since 00:00:00, January 1, 1970, GMT.
    [ 1] - Indicates the number of times a file is opened on a server
    [ 2] - Indicates the number of times a server device is opened
    [ 3] - Indicates the number of server print jobs spooled
    [ 4] - Indicates the number of times the server session started
    [ 5] - Indicates the number of times the server session disconnected
    [ 6] - Indicates the number of times the server sessions failed with error
    [ 7] - Indicates the number of server password violations
    [ 8] - Indicates the number of server access permission errors
    [ 9] - Indicates the number of server system errors
    [10] - Number of server bytes sent to the network
    [11] - Number of server bytes received from the network
    [12] - Indicates the average server response time (in milliseconds)
    [13] - Indicates the number of times the server required a request buffer but failed to allocate one
    [14] - Indicates the number of times the server required a big buffer but failed to allocate one
Failure: sets the @error flag to non-zero.

Remarks

No special group membership is required to obtain workstation statistics.
Only members of the Administrators or Server Operators local group can successfully execute this function on a remote server.

Related

_Net_Share_StatisticsGetWrk

See Also

Search NetStatisticsGet in MSDN Library.

Example

#include <GUIConstantsEx.au3>
#include <NetShare.au3>
#include <WindowsConstants.au3>

Global $g_idMemo

Example()

Func Example()
    Local $aInfo

    ; Create GUI
    GUICreate("NetShare", 400, 300)

    ; Create memo control
    $g_idMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
    GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New")
    GUISetState(@SW_SHOW)

    ; Get server statistics
    $aInfo = _Net_Share_StatisticsGetSvr(@ComputerName)
    MemoWrite("Statistics started ......: " & $aInfo[0])
    MemoWrite("Times file opened .......: " & $aInfo[1])
    MemoWrite("Times device opened .....: " & $aInfo[2])
    MemoWrite("Print jobs spooled ......: " & $aInfo[3])
    MemoWrite("Sessions started ........: " & $aInfo[4])
    MemoWrite("Sessions disconnected ...: " & $aInfo[5])
    MemoWrite("Session errors ..........: " & $aInfo[6])
    MemoWrite("Password violations .....: " & $aInfo[7])
    MemoWrite("Permission errors .......: " & $aInfo[8])
    MemoWrite("Server system errors ....: " & $aInfo[9])
    MemoWrite("Network bytes sent ......: " & $aInfo[10])
    MemoWrite("Network bytes recv ......: " & $aInfo[11])
    MemoWrite("Average response time ...: " & $aInfo[12])
    MemoWrite("Req buffer failures .....: " & $aInfo[13])
    MemoWrite("Big buffer failures .....: " & $aInfo[14])

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>Example

; Write message to memo
Func MemoWrite($sMessage = "")
    GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite