Функция _Net_Share_StatisticsGetSvr

 ↑  ←  Описание функции


_Net_Share_StatisticsGetSvr

Retrieves operating statistics for a server

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

Параметры

$sServer [необязательный] 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.

Возвращаемое значение

Успех:Возвращает массив следующего формата:
[ 0] - Indicates the time when statistics collection started. The value is stored as the number of secondsthat 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
Ошибка:Устанавливает @error

Примечания

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.

См. также

_Net_Share_StatisticsGetWrk

См. также

Искать NetStatisticsGet в библиотеке MSDN

Пример

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

Global $iMemo

_Main()

Func _Main()
    Local $hGUI, $aInfo

    ; Создаёт GUI
    $hGUI = GUICreate("NetShare", 400, 300)

    ; Создаёт элемент для заметок
    $iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
    GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
    GUISetState()

    ; 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])

    ; Цикл выполняется, пока окно не будет закрыто
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>_Main

; Записывает строку в элемент для заметок
Func MemoWrite($sMessage = "")
    GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite