automating RSA key pair generation

I want to automate the process of generating RSA keys. I want to remotley login to a linux machine from a windows maching without having to enter a password. For this I need to generate the RSA key pair. but I want to do this procedure on alot of linux machines. For which I was looking to automate the procedure. i would need a batch file to do so. I have no clue if this kind of a thing is feasible or not. I dont even know where to start from.

How would I scp into the remote machine to copy the public keys

Until you populate the keys in the remote systems, you'll have to login to them with a user and password - no choice! If you want to automate this login, I'd suggest you use Expect or the Perl::Expect library.

I am using active state perl. I think expect would not work in it