Ignoring switches in a device
Find the switch. Connect two wires across it. A simple Monostable circuit can generate a 5 s pulse. You can connect that to switch and there you go. As soon as there is power, the pulse will be generated simulating the long press behaviour.
If you cut the power, I assume it is off.
Challenges:

Switch is pulling the pin of an IC (MCU or other circuitry), so it Can be pulled up or pulled down by default. You have to monitor it first.

The other circuitry might be operating at a voltage and might not like different voltage. So better to use a 1:2 MUX type IC rather than directly driving via transistor or another 555 IC.

If there are any other function for the switch?

Your pulse generator circuitry should be powered from something.. Voltage source?


Update 1
Example of one shot pulse mode with 555 timer in one sho monostable mode.
an Example partial circuit:
A resistor of 100 kohm and 47uF capacitor will give a short pulse of ~5s.
The switch in the diagram can be shorted to ground via 100 ohm resistor.
a BJT can be used as inverter if needed depending on polarity of the pulse expected for the IC you are planning to drive.

I would use some thing like this which is a simple SPDT switch to short the switch pins.