daily pastebin goal
35%
SHARE
TWEET

AddGroupAndUser.js

ibi May 16th, 2014 2,026 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // (c)2008 by ibi, adds BLAH_group and BLAH_user with BLAH_password
  2. // exec only in non-gui mode
  3.  
  4. // variable definition (do not change these ones until you know what you're doing.)
  5. var wsh = new ActiveXObject("WScript.Shell");
  6. var ADS_UF_DONT_EXPIRE_PASSWD = 0x10000; // 65536
  7. var wbemFlagReturnImmediately = 0x10;
  8. var wbemFlagForwardOnly = 0x20;
  9. var envComputerName=wsh.ExpandEnvironmentStrings("%computername%");
  10. var envTemp=wsh.ExpandEnvironmentStrings("%temp%");
  11. var envWindir=wsh.ExpandEnvironmentStrings("%windir%");
  12.  
  13. colAccounts = GetObject("WinNT://" + envComputerName + "");
  14. try {
  15.   objGroup = colAccounts.Create("group", "BLAH_group");
  16.   objGroup.SetInfo();
  17.   WScript.Echo("group created");
  18.   }
  19. catch(e) {WScript.Echo("error:"+e);}
  20.  
  21. try {
  22.   objUser = colAccounts.Create("user", "BLAH_user");
  23.   objUser.SetPassword("BLAH_password");
  24.   objUser.SetInfo();
  25.   objGroup.Add(objUser.ADsPath);
  26.   WScript.Echo("user added");
  27.   }
  28. catch(e) {WScript.Echo("error:"+e.description);}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top