There are many exercise you can do, even if you have bad knees. A small table top bicycle is great for working your legs on a low resistance setting. You can squeeze a ball between your knees, use therabands, do calisthenics. I hired a personal trainer to design a safw workout program for me.
Good luck, pain is your signal you are overdoing it!
Exercise is the best possible remedy for your knees as long it does not consist of high impact.