Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

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 )

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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