You can try these codes to program your samsung tv remote codes with universal remote control491239414050and for more codes please check the reference link belowhttps://myuniversalremotecodes.com/remote-control-codes-for-samsung-tv/
This may just be a case of a bad electrical connection between the batteries and the contacts in the remote control.
Open the battery cover and remove the batteries from the remote.
Check the ends of the batteries and the battery contact terminals in the remote for any kind of rust, oxidation, or residue buildup. Clean the contacts thoroughly with the the flat edge of a screwdriver to removes any oxidation deposits and make the electrical contacts shiny again.
The shaking may just be jiggling the batteries a little and temporarily improving a bad electrical connection.
If you are unsure of the condition of the batteries, check them with a voltmeter or just put in fresh ones.
I am asumeing that the remote is from your dvd recorder/player which you wish to use to control your tv?
Which is possible. please follow the link to Samsung support, there are step by step instructions on how to use your dvd remote to control your tv.
Do you have a camcorder? Look at the remote through the camera while operating the remote.......look for a light at the infrared output. (you can't see it normally but will through the camera lens if it's working) Otherwise.....if you see the light....is it a programmable remote? Maybe time for a reprogramming. And....of course....no light....not working.
You can use your own SAMSUNG remote but some of the guide options and dvr buttons may not come across. If your remote allows you to 'map' the buttons you could circumvent the issue.
Another suggestion would be the universal remote by harmony. great gadget. pricey though.