I want to Count the number of client connection connected to a shared folder using vbscript. I can use any service but not WMIservice.

link|improve this question
feedback

1 Answer

Why would you not use WMI?

sComputer = "."
sShare = "C$"

Set oWMI = GetObject("winmgmts:\\" & sComputer & "\root\cimv2")
Set colConnections = oWMI.ExecQuery("ASSOCIATORS OF {Win32_Share.Name=""" & 
sShare & """} WHERE AssocClass=Win32_ConnectionShare")

WScript.Echo colConnections.Count & " open connections on \\" & sComputer & 
"\" & sShar

(Source: http://www.webmasterkb.com/Uwe/Forum.aspx/vbscript/12834/VBScript-and-Shares )

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.