Jump to content
Sign in to follow this  
Sven

_Net_Share_SessionGetInfo(), help needed

Recommended Posts

Sven

Having a problem getting _Net_Share_SessionGetInfo() to work. I'm at a Win7 x64 machine named "Comp1", the intention is to monitor its network connections (active time, idle time, who opened the connection). User Name is "Admin", which is an administrator account. But the following script

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

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
    Local $hGUI, $sServer, $aInfo

    ; Create GUI
    $hGUI = GUICreate("NetShare", 400, 300)

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

    ; Get session information
    $aInfo = _Net_Share_SessionGetInfo ("Comp1", "Comp1", "Admin")

    MemoWrite("Error ..........: " & @error)
    MemoWrite("Computer name ..: " & $aInfo[0])
    MemoWrite("User name ......: " & $aInfo[1])
    MemoWrite("Resources open .: " & $aInfo[2])
    MemoWrite("Seconds active .: " & $aInfo[3])
    MemoWrite("Seconds idle ...: " & $aInfo[4])
    MemoWrite("Connection type : " & $aInfo[5])
    MemoWrite("Client type ....: " & $aInfo[6])

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>_Main

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

always returns

Error ..........: 0
Computer name ..: 
User name ......: 
Resources open .: 
Seconds active .: 
Seconds idle ...: 
Connection type : 
Client type ....:

no matter what I do, although there are active connections. What am I doing wrong? Any help is greatly appreciated.

PS: Why is it that the search function of this forum cannot find anything about _Net_Share_SessionGetInfo? It should at least list this here topic, but no...

Edited by Sven

Share this post


Link to post
Share on other sites
Sven

Anyone?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×