Depending on the make and model (and configuration) of the switch, it may be possible to get this information from the computer. Most enterprise-class switches (e.g. Cisco Catalyst, HP Procurve, etc.) support one or more network discovery protocols, such as CDP or LLDP. In some cases, they're on by default. The computer normally ignores these discovery protocols, but it's possible to capture the data using a packet sniffer, or in the case with LLDP, actually running an LLDP server.
For example, most of the switches where I work are various Cisco Catalyst models, all of which support CDP. We commonly use a packet sniffer to capture CDP packets to determine which switch and port a particular PC is connected to. Though I haven't worked out how to do it, it should be possible to construct a similar filter to capture and decode LLDP packets as well.