Jump to content

Recommended Posts

Posted (edited)

maybe someone can look at my code and see if they can spot a problem

this is an excerpt from my RunOnceEX file

REG ADD %KEY%\015 /VE /D "Updating Path" /f
REG ADD %KEY%\015 /V 1 /D "%systemdrive%\install\Chpth.cmd" /f

REG ADD %KEY%\035 /VE /D "Add a User" /f
REG ADD %KEY%\035 /V 1 /D "%systemdrive%\install\user.cmd" /f

and the correspondng cmd files

path

PATH=%PATH%;%systemdrive%\perl\bin

Add user

@echo off
perl user.plx

and finally the perl code

#!/usr/bin/perl
use warnings;
use strict;



print "Please enter a username: ";
my $name = <STDIN>;
chomp $name;


print "Please enter a password: ";
my $password = <STDIN>;
chomp $password;
print "\n";

print "Thank You\n";

system "net user $name $password /add";
system "net localgroup Administrators $name /add";
system "net accounts /maxpwage:unlimited";

I have a feeling these the path and add user problem lies in the fact that if the path doesn't work neither will the add user (since it needs to know where perl is). Because I can run it (the perl file) locally and it works.

Thanks for taking the time to look at this.

Edited by pcdreams

Posted

Are you trying to add %systemdrive%\perl\bin to the PATH permanently? May I suggest pathman? It works for me all the time.

pathman /as %systemdrive%\perl\bin

if I remember the switches correctly.

Posted

thank you. Is pathman already there or is there someplace I can download it?

I think sp2 is really got me goofed up. I can't even delete accounts. or login with ones I've created.

Posted (edited)
thank you. Is pathman already there or is there someplace I can download it?
You got to download it. Start with clicking on pathman in my previous post :)

Added. I think it's packed in MSI, just install the MSI and you'll find pathman in system32. Drop pathman.exe into your OEM folders and enjoy :)

Edited by Vadikan

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...