You can force the compiler to generate all the desired template variations and then register those directly to the scripting engine.
For AngelScript you would register a fake shared pointer template class with no implementation and then properly register all the supported "T" types as full class specialisations.
Its probably still possible to make a generic wrapper implementation but it would not be as straight forward as the first option. most methods would end up having several runtime code paths to reinterpret something like a byte buffer into a shared pointer of void* or a shared pointer of shared_pointer_this_base*. Even then you would need to be sure that any classes deriving from shared_pointer_this_base would not generate an address offset for casting to that type.
I just went with template class specialisation when I had a similar issue :(