BEIJING — As the Chinese cyberpolice stiffened controls on information before the Communist Party leadership transition taking place this week, some companies in Beijing and nearby cities received orders to aid the cause.

Starting earlier this year, Web police units directed the companies, which included joint ventures involving American corporations, to buy and install hardware to log the traffic of hundreds or thousands of computers, block selected Web sites, and connect with local police servers, according to industry executives and official directives obtained by The New York Times. Companies faced the threat of fines and suspended Internet service if they did not comply by prescribed deadlines.

The initiative was one in a range of shadowy tactics authorities deployed in the months leading up to the 18th Party Congress, which is scheduled to end on Wednesday, in an escalating campaign against information deemed threatening to party rule. The effort, while spottily executed, was alarming enough to spur one foreign industry association to lodge a complaint with the government. Several foreign companies quietly resisted the orders, which posed risks to communications and trade secrets that they take pains to secure.

The events surrounding the party congress magnify the constant challenge facing China’s Internet security apparatus, which is to maintain the party’s lock on political power without choking off a wired China from the global economy.