Is it possible to write a script to reset user's password?

Is there anyway that I can reset user's password using a script/ssh command?
ie. emulate passwd command with a default password of abc123 or even null value?

> ssh server1 pwdadm user1 < /dev/null
or
> ssh server1 passwd user1 < /dev/null

neither worked for me.. but you know what I mean... I couldn't emulate enter keys.

I know this method is not recommended, but I've got more than 40 servers, and I don't want to login to every server to reset passwords.

Thanks in advance.

You may want to check out NIS.