No code as such but maybe a few pointers. You could use Active Directory for creating/manipulating user accounts. The
Active Directory Cookbook has some excellent examples on this. You could also use
Win32::GUI to build your application if you only plan to run it on Windows.