On Sun, May 22, 2005 at 05:40:09PM +0200, Niels S. Richthof enlightened us: > I am trying to create a user with this command: > > todo.pl "net user itcampus password /add /expires:never /active:yes > /fullname:\"itCampus GmbH\" /comment:\"Account fuer Fernzugriff\"" > > (on windows 2000 servers installed by Unattended) > > The "net user" command is valid according to the documentation output > of "net help user". > > The command creates the user with the password, and sets fullname and > comment correctly. But - the "password never expires" flag is NOT > set. Any ideas what is wrong? >
What is wrong is that you are unable to set the password expiration flag from the net command (even though you can set just about everything else...don't get me started). The expires option is for account expiration, not password expiration. The good news? I wrote a perl script that will set the never expires flag. It's not pretty, and perhaps the unattended crew will want to clean it up and include it in the distribution, but here it is: use Warnings; use Win32::NetAdmin; my $user = shift; if ($user) { my ($password, $passwordAge, $priveledge, $homeDir, $comment, $flags, $scriptPath); Win32::NetAdmin::UserGetAttributes("", $user, $password, $passwordAge, $priveledge, $homeDir, $comment, $flags, $scriptPath); $flags = $flags | UF_DONT_EXPIRE_PASSWD; Win32::NetAdmin::UserSetAttributes("", $user, $password, $passwordAge, $priveledge, $homeDir, $comment, $flags, $scriptPath); } else { print "You must pass a username as an argument.\n" } Matt -- Matt Hyclak Department of Mathematics Department of Social Work Ohio University (740) 593-1263
pgpdMPVITgq7N.pgp
Description: PGP signature