Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function CreateNewUser() {
  2.     var container = GetObject("WinNT://" + _wshNet.ComputerName);
  3.     var account = container.Create("user", _userName);
  4.     account.SetPassword(_password);
  5.     account.SetInfo();
  6. }
  7.  
  8. function AddUserToIIS_WPG() {
  9.     var iisWPG = GetObject("WinNT://" +
  10.            _wshNet.ComputerName + "/IIS_WPG,group");
  11.     var account = GetObject("WinNT://" +
  12.           _wshNet.ComputerName + "/" + _userName + ",user");
  13.     if (!(iisWPG.IsMember(account.AdsPath))) {
  14.         iisWPG.Add(account.AdsPath);
  15.     }
  16. }
  17.  
  18. function SetFolderPerms(user, folder, parms, ACCESS_FLAG) {
  19.     var oExec = _oShell.Exec("cacls \"" + folder + "\" " +
  20.                    parms + " "  + user + ":" + ACCESS_FLAG);
  21.     var oResponse = oExec.StdOut;
  22.    
  23.     while(oExec.Status == 0) {
  24.         Sleep(100);
  25.     }
  26.    
  27.     while(!oResponse.AtEndOfStream) {
  28.         var sLine = oResponse.ReadLine();
  29.         if (sLine.indexOf("processed") > -1) {
  30.             return true;
  31.         }
  32.         else {
  33.             return false;
  34.         }
  35.     }
  36. }
  37.  
  38. function CreateAppPool() {
  39.     var appPoolRoot = GetObject("IIS://localhost/w3svc/AppPools");
  40.     var newAppPool =
  41.         appPoolRoot.Create("IIsApplicationPool", _appPoolName);
  42.     newAppPool.WamUserName = _userName;
  43.     newAppPool.WamUserPass = _password;
  44.     newAppPool.LogonMethod = 1;
  45.     newAppPool.AppPoolIdentityType = 3;
  46.     newAppPool.SetInfo();
  47. }
  48.  
  49. function CreateVirtualDirectory() {
  50.     var oRoot = GetObject(_iisRoot);
  51.         var oVirDir = oRoot.Create("IIsWebVirtualDir", _vdirName);
  52.         oVirDir.AccessRead = true;
  53.         oVirDir.AccessScript = true;
  54.         oVirDir.AccessExecute = true;
  55.         oVirDir.DefaultDoc = "default.aspx";
  56.     oVirDir.Put("Path", _vdirPhysicalPath);
  57.         oVirDir.SetInfo();
  58.         oVirDir.AppCreate(true);
  59.         oVirDir.SetInfo();    
  60. }
  61.  
  62. function AssignAppPool() {
  63.         var oVirDir = GetObject(_iisRoot + "/" + _vdirName);
  64.         oVirDir.AppPoolId = _appPoolName;
  65.         oVirDir.SetInfo();
  66. }
  67.  
  68. function SetDefaultNetFX() {
  69.         var sys = _oShell.ExpandEnvironmentStrings("%windir%");
  70.         var fx = _oFso.BuildPath(sys, "Microsoft.NET\\Framework\\v2.0.50727");
  71.         var regiis = _oFso.BuildPath(fx, "aspnet_regiis.exe");
  72.    
  73.         _oShell.Run(regiis + " -sn W3SVC/1/Root/\"" + _vdirName + "\"", 0, true);
  74. }
  75.  
  76. function RestartIIS() {
  77.         _oShell.Run("iisreset /restart", 0, true);
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement