Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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.