I want to Count the number of client connection connected to a shared folder using vbscript. I can use any service but not WMIservice.
Asked
Active
Viewed 449 times
1 Answers
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 )

gWaldo
- 11,957
- 8
- 42
- 69