Thousands of Chinese-made surveillance cameras remain in use at U.S. military installations and other government sites after purchases of such devices were banned, highlighting the hurdles in replacing costly equipment to address national-security concerns.

More than 2,700 of the banned cameras are in operation across the federal government today, according to data from Forescout, a security-technology company that detects equipment on networks under contract with the federal government. The total is likely higher because...