1 #!/usr/bin/env smbscript
3 var options = GetOptions(ARGV,
6 "POPT_COMMON_CREDENTIALS");
7 if (options == undefined) {
8 println("Failed to parse options");
12 if (options.ARGV.length != 2) {
13 println("Usage: ejsnet.js <DOMAIN> <NEW USER NAME>");
17 /* use command line creds if available */
18 var creds = options.get_credentials();
20 var ctx = NetContext(creds);
21 var usr_ctx = ctx.UserMgr(options.ARGV[0]);
22 if (usr_ctx == undefined) {
23 println("Couldn't get user management context.");
27 var status = usr_ctx.Create(options.ARGV[1]);
28 if (status.is_ok != true) {
29 println("Failed to create user account " + options.ARGV[1] + ": " + status.errstr);
34 var info = usr_ctx.Info(options.ARGV[1]);
36 println("UserInfo.AccountName = " + info.AccountName);
37 println("UserInfo.Description = " + info.Description);
38 println("UserInfo.FullName = " + info.FullName);
39 println("UserInfo.AcctExpiry = " + info.AcctExpiry);
41 println("Null UserInfo returned - account unknown");
45 var status = usr_ctx.Delete(options.ARGV[1]);
46 if (status.is_ok != true) {
47 println("Failed to delete user account " + options.ARGV[1] + ": " + status.errstr);