Discussion Locked

Shared Session data with VB6 + WMI?

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I'm using VB 6 on Windows XP Pro -
I need to know how to grab the "Shared Folders Sessions" collection. (This can be viewed on XP by right clicking my computer, click manage, then shared folders, sessions)

I've been told I can use WMI in VB6 to do this, but I don't know where to find the code....please provide code to grab this collection info. I need VB to do it, not a VBS script file.

Thanks!!!

1 reply

by tcolgrove

Win32_ServerConnection will show you that information. It's properties include .ComputerName, .ShareName, .UserName

'--------
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSessions = objWMIService.InstancesOf("Win32_ServerConnection")
For Each Connection In colSessions
'Put your code here
Next

This discussion is closed to new replies.