There are many meanings listed below (from Lingvo). But I'd say that the general point is the following:
A при B (B is in prepositional) = B is the main big object and A is a small object accompanying B.
при (prep.)
1) (около, возле, рядом) near, close to, at, by;
(в названиях битв) of
при впадении реки — near the river's mouth
битва при Бородине — the battle of Borodino
2) (в присутствии) in smb's presence
это надо сделать при нём — this must be done in his presence
при посторонних [при детях] — in front of [before] strangers [the children]
3) (во время, в эпоху) in the time of; (о правительстве, власти и т.п.) under
при Пушкине — in Pushkin's ['pu-] time
при Петре Первом [при Стюартах, при царе] — under Peter the First [under the Stuarts, under the tsar]
4) (с собой) by; (на себе) about, on
у него этого при себе нет — he hasn't got it by / on him
у него нет при себе денег — he has no money with / on him
5) (при обозначении обстоятельств действия) by, when (+ gerund)
при электричестве [свечах, дневном свете] — by electric light [by candlelight, by daylight]
при переходе через улицу — when crossing the street
6) (обладая чем-л) with; (несмотря на) for
при таких знаниях [талантах] — with such [so much] knowledge [talent]
при таком здоровье — with such health; (о плохом состоянии здоровья) when one's health is so poor
при всём своём уважении [любви, преданности] он не мог — for all his respect [love, devotion] he couldn't
7) (в составе неосновных подразделений какой-л организации) under
институт при Министерстве труда — Institute under the Ministry of Labour
бюро при премьер-министре — bureau (functioning) under the prime minister
школа при соборе — cathedral school
при фабрике действуют курсы — the factory runs a training course; there's a training course operating on the factory premises

(присоединённый) attached to; (прикомандированный) assigned to
госпиталь при дивизии — hospital attached to the division