Функция _Net_Share_SessionDel

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


_Net_Share_SessionDel

Ends a network session between a server and a workstation

#include <NetShare.au3>
_Net_Share_SessionDel([$sServer = "" [, $sClientName = "" [, $sUserName = ""]]])

Параметры

$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.
$sClientName [необязательный] Specifies the computer name of the client to disconnect. If blank, then all the sessions of the
    user identified by the username parameter will be deleted on the server specified by $sServer.
$sUserName [необязательный] Specifies the name of the user whose session is to be terminated. If this parameter is blank,
    all user sessions from the client specified by the $sClientName parameter are to be terminated.

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

Успех:Возвращает True
Ошибка:Возвращает False

Примечания

Only members of the Administrators or Server Operators local group can execute this function. You must pass
either $sClientName or $sUserName (or both) for this function to work.

См. также

_Net_Share_ShareDel

См. также

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

Пример

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

Global $iMemo

_Main()

Func _Main()
    Local $hGUI, $sServer

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

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

    ; Get server and share information
    $sServer = InputBox("NetWork Demo", "Enter Server Name:", "\\MyServer", "", 200, 130)
    If @error Then Exit

    ; Delete all our sessions on the server
    _Net_Share_SessionDel ($sServer, @ComputerName)
    MemoWrite("Error ...................: " & @error)

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

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