Pms not recognised after password change

I wrote this for Synology but should work fine for everyone.