Getting resting positions of joints in a RIG

I am making a CFrame animation handler but I was wondering how I can get the resting CFrames of the Motor6D in any rig as I have no idea how I can automatically get these values in a script. If anyone has any ideas then please tell me.

You might have to save them first thing when the script starts. I think this is what the deafult character controller does.