NetSessionEnum or Net32SessionEnum

The NetSessionEnum API provides information about all current sessions to a server.