Executing command-line instructions / Adding NT users and setting directory permissions via CGI or ISAPI

Hey, i need to write a web application (isapi, cgi-bin, cgi-win,
whatever.. ) that can add nt users.

we got a console app written that can spawn the net and cmd programs and

add users, but this doesn't work when we try and run it as a cgi.

actually, here's the code we have so far(as i said, it works locally,
but doens't over the web). if you replace the lines in appendix a that
end with /**** with the contents of appendix b, you will get our second
try(which didnt' work either).

if anyone knows how to do this(through asp, some api, whatever), PLEASE
tell us. thank you.

Appendix A:

procedure createdr(dirname:string);
var dirset:string;
c1:string;
begin
dirset:='c:\'+dirname;
createdir(dirset);
end;

procedure setsecurity(s,t:string);
var c1:string;
    c2,c3:string;
begin
c1:='net user /add ' +s+ ' ' +t;
c2:='cmd /c cacls c:\'+s+' /e /g '+s+':f';

ShellExecute(0, 'open', 'net', pchar(c1), nil, SW_SHOW); //****
ShellExecute(0, 'open', 'cmd', pchar(c2), nil, SW_SHOW); //****
end;

procedure createuser(s,t:string);

begin
createdr(s);
setsecurity(s,t);
end;

procedure TWebModule1.WebModule1adduserAction(Sender: TObject;
  Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var
 u,p:string;
begin
u:=request.QueryFields.values['user_name'];
p:=request.QueryFields.values['user_password'];
createuser(u,p);
response.content:='User Created:1:'+resp1+'2:'+resp2;
handled:=true;
end;

Appendix B:

case WinExec(pchar(c1),SW_hide) of
 0:
  resp1:='out of resources';
 ERROR_BAD_FORMAT:
  resp1:='bad format';
 ERROR_FILE_NOT_FOUND:
  resp1:='file not found';
 ERROR_PATH_NOT_FOUND:
  resp1:='path not found';
 end;

case WinExec(pchar(c2),SW_hide) of
 0:
  resp2:='out of resources';
 ERROR_BAD_FORMAT:
  resp2:='bad format';
 ERROR_FILE_NOT_FOUND:
  resp2:='file not found';
 ERROR_PATH_NOT_FOUND:
  resp2:='path not found';
 end;

-jeff
kaleidoscope information systems incorporated