All vehicles registered in New York State must get a safety inspection and an emissions inspection every 12 months. Both inspections are also required when the ownership of a vehicle is transferred. (Some vehicles are exempt from emissions inspections.) Both inspections are done at the same time by a DMV-certified inspector at privately-owned inspection stations licensed by DMV...
If you buy a vehicle from a NYS dealer, the dealer must have the vehicle inspected. The inspections must occur no more than 30 days before the vehicle is delivered to you.