Guest User

Untitled

a guest
Mar 2nd, 2016
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VBScript 68.68 KB | None | 0 0
  1. '*  Script Name: UserAccount.VBS
  2. '*  Author:  Jeffrey Lathrop
  3. '*  Written:  February 16, 2003
  4. '*  Purpose:  To Automate the account creation process for the HelpDesk.  This script will
  5. '*            create a unique alias, populate the address fields (city, state, zip, phone), office,
  6. '*            description, create the mailbox, create a password, email the information to the office
  7. '*            admin, and create a work log.
  8. '*------------------------------------------------------------------------------------------------------------------------------------
  9. '*$Log:   I:/Applications/PVCS8/Data/Provisioning/archives/AD Scripts/useraccount1.vbs-arc  $
  10. '*
  11. '* Incident #91305 cbcaps0048, mej 10/31/2014 allow email overide
  12. '*------------------------------------------------------------------------------------------------------------------------------------
  13. '*
  14. '* Incident # 5937 cbcaps0030, mej 11/05/2013 use exchange 2010 calls
  15. '*------------------------------------------------------------------------------------------------------------------------------------
  16. '*  Date:  Feb 15, 2013
  17. '*  Incident # 6282 cbcaps0033, mej 02/15/2013
  18. '*  What was changed?: modify to load department information into active directory add include files
  19. '*  Reason for Change:  need department information for downstream data use like ciber university
  20. '*------------------------------------------------------------------------------------------------------------------------------------
  21. '*  Date:  Feb 15, 2012
  22. '* Ticket # 274098 cbcaps0016, mej 02/15/2012
  23. '*  What was changed?: modify to read domain controller from caps controller
  24. '*  Reason for Change:  enable the exchange creation and active directory creation use the
  25. '*  same domain controller for creation
  26. '*------------------------------------------------------------------------------------------------------------------------------------
  27. '*  Date:  Aug 19, 2011
  28. '*  Ticket: 243168, CBCAPS0004
  29. '*  What was changed: modified call for createmailuser to call powershell enable_cibermailbox.ps1 script
  30. '*  Modified by:  Mark Johnson
  31. '*  Reason for Change:  Exchange 2007 does not allow vbs to create email mailboxes
  32. '*------------------------------------------------------------------------------------------------------------------------------------
  33. '*   Rev 1.8   Feb 13 2006 13:55:44   TBatuwitage
  34. '*02/13/2006 - Call#: 00041986 - Changes PW text to autouseraccount.vbs and useraccount1.vbs
  35. '*
  36. '*Added/removed text from the existing scripts to resemble the sample screen that was given by Farhad.
  37. '*
  38. '*
  39. '*   Rev 1.7   06 Feb 2006 12:52:10   aludlow
  40. '*2006.02.06 - 41983 - Changes dist list to autouseraccount.vbs and useraccount1.vbs.  Changed ".CORP CIBER Europe" to ".EU"
  41. '*
  42. '*   Rev 1.6   24 Jan 2006 09:42:58   aludlow
  43. '*2006.01.24 - Call # 41251 - Change CIBER-COM to CIBERspace in script
  44. '*
  45. '*   Rev 1.5   11 Jan 2006 10:30:58   aludlow
  46. '*2006.01.11 - Call # 37512 - Modify the account automation script.  Modified the script not to change the batch file that an individual was associated with.  
  47. '*
  48. '*   Rev 1.4   Oct 28 2005 14:33:44   aludlow
  49. '*2005.10.28 - Call # 35160 - CIBEREurope and CSP All Emp - Commented out code that added the Europeans in the CSP All Emp security group.
  50. '*
  51. '*   Rev 1.3   Sep 21 2005 12:19:14   aludlow
  52. '*Corrected an issue with a change I made.
  53. '*
  54. '*   Rev 1.2   Sep 19 2005 12:01:32   aludlow
  55. '*Changes at Farhad's request.
  56. '*
  57. '*   Rev 1.1   Aug 09 2005 15:02:36   aludlow
  58. '*Reviewed
  59. '*
  60. '*   Rev 1.0   Aug 09 2005 14:42:22   aludlow
  61. '*Initial Revision
  62. '*------------------------------------------------------------------------------------------------------------------------------------
  63. '*On Error Resume Next
  64.  
  65. Call Main()
  66.  
  67. '* Incident # 6282 cbcaps0033, mej 02/15/2013 add department begin add includefile
  68. sub includeFile (fSpec)  
  69.     wscript.echo "include file "& fspec  
  70.     dim fileSys, file, fileData    
  71.     set fileSys = createObject ("Scripting.FileSystemObject")    
  72.     set file = fileSys.openTextFile (fSpec)    
  73.     fileData = file.readAll ()    
  74.     file.close    
  75.     executeGlobal fileData    
  76.     set file = nothing    
  77.     set fileSys = nothing
  78. end sub
  79. '* Incident # 6282 cbcaps0033, mej 02/15/2013 add department end add includefile
  80.  
  81. function MODulus (ByVal iNumber, ByVal iDivisor)
  82.   DIM iVal
  83.   DIM itemp
  84.   if (iDivisor > 0) then
  85.     iVal = Int(iNumber)/Int(iDivisor)
  86.     itemp = Int(iVal) * iDivisor
  87.     if (itemp > iNumber) then
  88.       itemp = Int(iVal-1) * iDivisor
  89.     end if
  90.     Modulus = Int(iNumber) - Int(itemp)
  91.   else
  92.     Modulus = 0
  93.   end if
  94.  
  95. end function
  96.  
  97. function StripTrailingWS(str)
  98.    DIM rtstr
  99.    if (len(str) > 0) then
  100.    isws = 0
  101.    if (Right(str,1) = " ") then
  102.       rtstr = StripTrailingWS(Left(str,Len(str)-1))
  103.    else
  104.       rtstr = str
  105.    end if
  106.    StripTrailingWS = rtstr
  107.    else
  108.    StripTrailingWS = str
  109.    end if
  110. end function
  111.  
  112. function TestDivision(ByVal cc)
  113.    DIM ppre
  114.    if cc < 2000 then
  115.       ppre = "CP"
  116.    elseif cc < 4000 then
  117.       ppre = "ES"
  118.    elseif cc < 7000 then
  119.       ppre = "CS"
  120.    elseif cc < 9100 then
  121.       ppre = "ES"
  122.    else
  123.       ppre = "CP"
  124.    end if
  125.    TestDivision = ppre
  126. end function
  127.  
  128. function CreatePassword(ByVal eid, ByVal cc)
  129.    Randomize()
  130.    DIM remainder
  131.    DIM pwd
  132.    pwd="       "
  133.    remainder = Modulus(Int(right(eid,5)),5)
  134.    Select Case remainder
  135.    Case 1
  136.      pwd = chr(Int(25 * RND + 97))
  137.      pwd = pwd & chr(Int(25 * RND + 65))
  138.      pwd = pwd & chr(Int(12 * RND + 33))
  139.      pwd = pwd & chr(Int(25 * RND + 97))
  140.      pwd = pwd & chr(Int(9 * RND + 48))
  141.      pwd = pwd & chr(Int(9 * RND + 48))
  142.      pwd = pwd & chr(Int(25 * RND + 97))
  143.      pwd = pwd & chr(Int(25 * RND + 97))
  144.   Case 2
  145.      pwd = chr(Int(12 * RND + 33))
  146.      pwd = pwd & chr(Int(25 * RND + 65))
  147.      pwd = pwd & chr(Int(25 * RND + 97))
  148.      pwd = pwd & chr(Int(9 * RND + 48))
  149.      pwd = pwd & chr(Int(25 * RND + 97))
  150.      pwd = pwd & chr(Int(9 * RND + 48))
  151.      pwd = pwd & chr(Int(25 * RND + 97))
  152.      pwd = pwd & chr(Int(25 * RND + 97))
  153.   Case 3
  154.      pwd = chr(Int(25 * RND + 97))
  155.      pwd = pwd & chr(Int(25 * RND + 65))
  156.      pwd = pwd & chr(Int(12 * RND + 33))
  157.      pwd = pwd & chr(Int(9 * RND + 48))
  158.      pwd = pwd & chr(Int(25 * RND + 97))
  159.      pwd = pwd & chr(Int(25 * RND + 97))
  160.      pwd = pwd & chr(Int(9 * RND + 48))
  161.      pwd = pwd & chr(Int(25 * RND + 97))
  162.   Case 4
  163.      pwd = chr(Int(12 * RND + 33))
  164.      pwd = pwd & chr(Int(9 * RND + 48))
  165.      pwd = pwd & chr(Int(25 * RND + 97))
  166.      pwd = pwd & chr(Int(25 * RND + 65))
  167.      pwd = pwd & chr(Int(25 * RND + 97))
  168.      pwd = pwd & chr(Int(9 * RND + 48))
  169.      pwd = pwd & chr(Int(25 * RND + 97))
  170.      pwd = pwd & chr(Int(25 * RND + 97))
  171.   Case else
  172.      pwd = chr(Int(25 * RND + 65))
  173.      pwd = pwd & chr(Int(25 * RND + 97))
  174.      pwd = pwd & chr(Int(9 * RND + 48))
  175.      pwd = pwd & chr(Int(12 * RND + 33))
  176.      pwd = pwd & chr(Int(25 * RND + 97))
  177.      pwd = pwd & chr(Int(25 * RND + 97))
  178.      pwd = pwd & chr(Int(9 * RND + 48))
  179.      pwd = pwd & chr(Int(25 * RND + 97))
  180.   End Select
  181.    pwd = replace(pwd,"I","L")
  182.    pwd = replace(pwd,"1","L")
  183.    pwd = replace(pwd,"l","L")
  184.    pwd = replace(pwd,"0","M")
  185.    pwd = replace(pwd,"O","M")
  186.    pwd = replace(pwd,"o","M")
  187.    CreatePassword = pwd
  188. End function
  189.  
  190. function GenerateNBAlias(ByVal Ln, ByVal Fn, ByVal MI, ByVal i)
  191.    Dim flen
  192.    Dim j
  193.    j = 0
  194.    flen = Len(fn)
  195.    if (i > flen) then
  196.      j = i - flen
  197.    end if
  198.    if (j > 0) then
  199.      if (Len(MI) > 0) then
  200.         GenerateNBAlias = Fn&MI&Ln&j
  201.      else
  202.         GenerateNBAlias = Fn&LN&j
  203.      end if
  204.    elseif (i>1) then
  205.      if (Len(MI) > 0) then
  206.        GenerateNBAlias = Left(Fn,i-1)&MI&LN
  207.      else
  208.        GenerateNBalias = Left(Fn,i)&LN
  209.      end if
  210.    else
  211.      GenerateNBAlias = Left(Fn,i)&LN
  212.    end if
  213. End Function
  214.  
  215. function GenerateBAlias(ByVal Ln, ByVal Fn, ByVal MI, ByVal i)
  216.    DIM j
  217.    if (i = 1) then
  218.      GenerateBAlias = Ln & "_" & Fn
  219.    elseif (i = 2) then
  220.      if (Len(MI) > 0) then
  221.        GenerateBAlias = Ln & "_" & Fn & "_" & MI
  222.      else
  223.        GenerateBAlias = Ln & "_" & fn &j
  224.      end if
  225.    else
  226.      if (Len(MI) > 0) then
  227.        j= i - 2
  228.        GenerateBAlias = Ln & "_" & Fn & "_" & MI & j
  229.      else
  230.        j = i - 1
  231.        GenerateBAlias = Ln & "_" & fn &j
  232.      end if
  233.    end if
  234. end Function
  235.  
  236. function IsConsultant(ByVal etype)
  237.   DIM scid
  238.   scid = Left(etype,2)
  239.   if (scid = "LC") then
  240.    IsConsultant = 1
  241.   elseif (etype <= 01199) then
  242.    IsConsultant = 1
  243.   elseif (etype >= 01700) then
  244.    IsConsultant = 1
  245.   else
  246.    IsConsultant = 0
  247.   end if
  248. end Function
  249.  
  250. function GetTitle(ByVal etype)
  251.   DIM emtystr,emtstr2
  252.   emtystr = Left(etype,3)
  253.   emtystr2 = Left(etype,2)
  254.   if ((emtystr = "011") or (emtystr2 = "11")) then
  255.     GetTitle = "Consultant"
  256.   elseif ((emtystr = "012") or (emtystr2 = "12"))then
  257.     GetTitle = "Sales Exec"
  258.   elseif ((emtystr = "013") or (emtystr2 = "13")) then
  259.     GetTitle = "Administration"
  260.   elseif ((emtystr = "014") or (emtystr2 = "14")) then
  261.     GetTitle = "Recruiter"
  262.   elseif ((emtystr = "015") or (emtystr2 = "15")) then
  263.     GetTitle = "Manager"
  264.   elseif ((emtystr = "016") or (emtystr2 = "16")) then
  265.     GetTitle = "CSM"
  266.   else
  267.     GetTitle = "Subcontractor"
  268.   end if
  269. end function
  270.  
  271. Sub CreateNewHiresFile(ByVal iNumUsers)
  272. DIM cnhffso
  273. DIM outFile
  274. DIM costcenter
  275. DIM lastname
  276. DIM firstname
  277. DIM middleinitial
  278. DIM empid
  279. DIM emptype
  280. DIM strTest
  281. DIM stralias
  282. DIM strEmail
  283. strtest = ""
  284. emptype = "01100"
  285.   Set cnhffso = CreateObject("Scripting.FileSystemObject")
  286.   Set OutFile = cnhfFSO.CreateTextFile("c:\euNewhires.txt",True)
  287.   OutFile.WriteLine "CostCenter" & Chr(9) &"LastName" & Chr(9) &"FirstName" & Chr(9) & "MiddleInitial" & Chr(9) & "EmployeeID" & Chr(9) & "JobCode" & Chr(9) &"Alias" & Chr(9) &"EmailTo"
  288.   for i = 1 to iNumUsers
  289.     while (strtest <> "Y")
  290.       costcenter = ""
  291.       lastname = ""
  292.       firstname = ""
  293.       middleinitial = ""
  294.       empid = ""
  295.       strtest = ""
  296.       stralias= ""
  297.       strEmail = ""
  298.       Wscript.Stdout.Write "Enter Cost Center: "
  299.       costcenter = Wscript.Stdin.Readline
  300.       Wscript.Stdout.Write "Enter Last Name: "
  301.       lastname = Wscript.Stdin.Readline
  302.       Wscript.Stdout.Write "Enter First Name: "
  303.       firstname = Wscript.Stdin.Readline
  304.       Wscript.Stdout.Write "Enter Middle Initial: "
  305.       middleinitial = Wscript.Stdin.Readline
  306.       Wscript.Stdout.Write "Enter Employee ID: "
  307.       empID = Wscript.Stdin.Readline
  308.       Wscript.Stdout.Write "Enter Alias: "
  309.       stralias = Wscript.Stdin.Readline
  310.       WScript.Stdout.Write "Enter CIBER Europe Email Address: "
  311.       strEmail = Wscript.Stdin.Readline
  312.       while ((strtest <> "Y") AND (strtest <> "N"))
  313.          Wscript.Stdout.Writeline "Are these values correct (Y/N)?"
  314.          Wscript.Stdout.Write costcenter & "     " & Lastname & "     " & Firstname & "     " & Middleinitial & "     " & empid & "     " & emptype & "     " & stralias & "     " &strEmail& "   (Y/N)  "
  315.          strTest = UCASE(Wscript.Stdin.Readline)
  316.       Wend
  317.       if (strtest = "Y") then
  318.         OutFile.WriteLine costcenter & Chr(9) & lastname & Chr(9) & firstname & Chr(9) & MiddleInitial & Chr(9) & empid & Chr(9) & emptype & Chr(9) & stralias & Chr(9) & strEmail
  319.       end if
  320.     wend
  321.   Next
  322.   Outfile.Close
  323.   set OutFile = Nothing
  324.   set cnhffso = Nothing
  325. End Sub
  326. '* Ticket # 274098 cbcaps0016, mej 02/15/2012 begin
  327. Sub  CheckAlias (ByVal Ln, ByVal Fn, ByVal MI, ByVal eid, ByVal etype, ByVal NBorB, ByVal group_base, ByVal FQDN, ByVal Root_DN, ByVal Emailbase,strAlias, StrStatus)
  328. '* Ticket # 274098 cbcaps0016, mej 02/15/2012 end
  329.   WScript.Echo "Start CheckAlias"
  330.    DIM objCommand
  331.    DIM objConnection
  332.    DIM unique
  333.    DIM subCtest
  334.    DIM i
  335.    DIM objRecordset, objRecordSet1
  336.    DIM tid
  337.    DIM emailTest
  338.    DIM eaExist
  339.    DIM objUser
  340.  
  341.    unique = 0
  342.    i = 1
  343.    subcTest = Left(eid,2)
  344.    strStatus = "OK"
  345.    eaExist = 0
  346.  
  347.    Set objConnection = CreateObject("ADODB.Connection")
  348.    objConnection.Open "Provider=ADsDSOObject;"
  349.  
  350.    Set objCommand = CreateObject("ADODB.Command")
  351.    objCommand.ActiveConnection = objConnection
  352.    objCommand.Properties("Chase Referrals") =  ADS_CHASE_REFERRALS_SUBORDINATE
  353.    objCommand.Properties("Page Size")= 1000
  354.    objCommand.Properties("Size Limit")= 15000
  355.    objCommand.Properties("Sort On") = "Name"
  356.    '* Ticket # 274098 cbcaps0016, mej 02/15/2012 begin
  357. '   objCommand.CommandText = "<GC://"&group_base"dc=ciber,dc=cbr,dc=inc>;(&(objectCategory=Person)(proxyAddresses=*));samAccountName,proxyaddresses,distinguishedname;subtree"
  358.   objCommand.CommandText = "<GC://"&group_base&">;(&(objectCategory=Person)(proxyAddresses=*));samAccountName,proxyaddresses,distinguishedname;subtree"
  359.    '* Ticket # 274098 cbcaps0016, mej 02/15/2012 end
  360.   Set objRecordSet1 = objCommand.Execute
  361.  
  362.    while unique = 0
  363. wscript.echo strAlias
  364.       objCommand.CommandText = "<"&FQDN&">;(&(objectCategory=User)(samAccountName=" & strAlias & "));samAccountName,employeeID,distinguishedname;subtree"
  365.       Set objRecordSet = objCommand.Execute
  366.  
  367.       If objRecordset.RecordCount = 1 Then
  368.       '* Ticket # 274098 cbcaps0016, mej 02/15/2012 begin
  369. 'wscript.echo objRecordSet.Fields("employeeID")
  370.         Set objUser = GetObject(Root_DN&"/"&objRecordSet.Fields("distinguishedName"))
  371.       '* Ticket # 274098 cbcaps0016, mej 02/15/2012 end
  372.         objUser.GetInfo
  373.          tid = objUser.Get("employeeID")
  374. wscript.echo tid
  375.          if (eid = tid) then
  376.             StrStatus = "Account Already Exists"
  377.             unique = 1
  378.          else
  379.            unique = 0
  380.          end if
  381.       else
  382.       '* Ticket # 274098 cbcaps0016, mej 02/15/2012 begin
  383.         'EmailTest = "smtp:"&strAlias&"@ciber.com"
  384.             EmailTest = "smtp:"&strAlias&emailbase
  385.       '* Ticket # 274098 cbcaps0016, mej 02/15/2012 end
  386.         Do While Not objRecordSet1.EOF
  387.             For Each varRecord in objRecordset1.Fields("proxyAddresses").Value
  388.                If UCASE(varRecord) <> UCASE(emailtest) then
  389.                Else
  390.                   eaExist = 1
  391.                   Exit Do
  392. '* Ticket # 274098 cbcaps0016, mej 02/15/2012 end        
  393.               end if
  394.             Next
  395.             objRecordset1.MoveNext
  396.          Loop
  397.          if (eaExist = 0) then
  398.             unique = 1
  399.             StrStatus = "OK"
  400.          else
  401.             eaExist = 0
  402.             unique =0
  403.          end if
  404.          set objRecordset1 = Nothing
  405.       end if
  406.       i = i + 1
  407.    wend
  408.    set objRecordSet = Nothing
  409.    set objUser = Nothing
  410.    set objConnection = Nothing
  411.    set objCommand = Nothing
  412.    Wscript.Echo "End CheckAlias"
  413. End Sub
  414.  
  415. Sub ReadCostCenterTable(ByVal cc, country, lcity, postalcode, state, streetaddress, telephoneNumber, uOU, sOfficeName, srv, nbmserver, bmserver, bstore,emailto )
  416.    Wscript.Echo "Start ReadCostCenter"
  417.    Const adOpenStatic = 3
  418.    Const adLockOptimistic = 3
  419.    Const adUseClient = 3
  420.    DIM objConnection
  421.    DIM objRecordset
  422.  
  423.    Set objConnection = CreateObject("ADODB.Connection")
  424.    Set objRecordset = CreateObject("ADODB.Recordset")
  425.    objConnection.Open "data source='Accounts';"
  426.    objRecordset.CursorLocation = adUseClient
  427.    objRecordset.Open "SELECT * FROM CostCenter WHERE CostCenter = '"&cc & "'" , objConnection, adOpenStatic, adLockOptimistic
  428.    if (objRecordSet.RecordCount <> 1) then
  429.      uOU = "NewUsers"
  430.      '* Ticket # 274098 cbcaps0016, mej 02/15/2012 begin
  431.     'emailto = "helpdesk@ciber.com"
  432.     emailto = emailtostatic
  433.      '* Ticket # 274098 cbcaps0016, mej 02/15/2012 end
  434.   else
  435.      country         = StripTrailingWS(objRecordSet.Fields("country"))
  436.      lcity           = StripTrailingWS(objRecordSet.Fields("city"))
  437.      postalcode      = StripTrailingWS(objRecordset.Fields("zip"))
  438.      state           = StripTrailingWS(objRecordSet.Fields("state"))
  439.      streetaddress   = StripTrailingWS(objRecordSet.Fields("street"))
  440.      telephoneNumber = StripTrailingWS(objRecordSet.Fields("phone"))
  441.      uOU             = StripTrailingWS(objRecordSet.Fields("OU"))
  442.      sOfficeName     = StripTrailingWS(objRecordSet.Fields("OfficeName"))
  443.      srv             = StripTrailingWS(objRecordSet.Fields("server"))
  444.      nbmserver       = StripTrailingWS(objRecordSet.Fields("mbserver"))
  445.      bmserver        = StripTrailingWS(objRecordSet.Fields("bserver"))
  446.      bstore          = StripTrailingWS(objRecordSet.Fields("bstore"))
  447.      emailto         = StripTrailingWS(objRecordSet.Fields("emailTo"))
  448.    end if
  449.    objRecordset.Close
  450.    objConnection.Close
  451.    set objRecordset = Nothing
  452.    set objConnection = Nothing
  453.    Wscript.Echo "End ReadCostCenter"
  454. End Sub
  455.  
  456. Sub ReadMBServer(ByVal mbserver,mbstore, mbstoregrp, mbadmingrp,ByVal etype)
  457.    Wscript.Echo "Starting ReadMBServer"
  458.    Const adOpenStatic = 3
  459.    Const adLockOptimistic = 3
  460.    Const adUseClient = 3
  461.    DIM objConnection
  462.    DIM objRecordset
  463.  
  464.    Set objConnection = CreateObject("ADODB.Connection")
  465.    Set objRecordset = CreateObject("ADODB.Recordset")
  466.    objConnection.Open "data source='Accounts';"
  467.    objRecordset.CursorLocation = adUseClient
  468. '*  Ticket: 243168, CBCAPS0004 begin
  469. '* old
  470. '*   if (etype = "0") then
  471. '*     objRecordset.Open "SELECT * FROM MBServers WHERE store = '"&mbstore & "' and mbserver = '"&mbserver&"'" , objConnection, adOpenStatic, adLockOptimistic
  472. '*   else
  473. '*     objRecordset.Open "SELECT * FROM MBServers WHERE jobcode = '"&etype & "' and mbserver = '"&mbserver&"'" , objConnection, adOpenStatic, adLockOptimistic
  474. '*   end if
  475. '* new 
  476.     objRecordset.Open "SELECT * FROM MBServers WHERE jobcode = '"&etype & "'" , objConnection, adOpenStatic, adLockOptimistic
  477. '*  Ticket: 243168, CBCAPS0004 end
  478. '*
  479.   mbstore = StripTrailingWS(objRecordSet.Fields("store"))
  480.    mbstoregrp = StripTrailingWS(objRecordSet.Fields("storagegrp"))
  481.    mbadmingrp = StripTrailingWS(objRecordSet.Fields("admingrp"))
  482.    objRecordset.Close
  483.    objConnection.Close
  484.    Set objRecordset = Nothing
  485.    Set objConnection = Nothing
  486.    Wscript.Echo "End ReadMBServer"
  487. End Sub
  488. '*Incident # 6282 cbcaps0033, mej 02/15/2013 add department -- comment out readcaps begin
  489. '* Ticket: 243168, CBCAPS0004 begin
  490. 'Sub ReadCAPS_Control(ByVal CAPS_CONTROL_VALUE,capsvaluedesc)
  491. '   Wscript.Echo "Starting ReadCAPS_Control"
  492. '   Const adOpenStatic = 3
  493. '   Const adLockOptimistic = 3
  494. '   Const adUseClient = 3
  495. '   DIM objConnection
  496. '   DIM objRecordset
  497. '
  498. '   Set objConnection = CreateObject("ADODB.Connection")
  499. '   Set objRecordset = CreateObject("ADODB.Recordset")
  500. '   objConnection.Open "data source='Accounts';"
  501. '   objRecordset.CursorLocation = adUseClient
  502. '   objRecordset.Open "Select * from CAPS_Control where CAPS_CONTROL_VALUE = '"&CAPS_CONTROL_VALUE&"'" ', objConnection, adOpenStatic, adLockOptimistic
  503. '   capsvaluedesc= StripTrailingWS(objRecordSet.Fields("Description"))
  504. 'wscript.echo "Description "&capsvaluedesc
  505. '   objRecordset.Close
  506. '   objConnection.Close
  507. '   Set objRecordset = Nothing
  508. '   Set objConnection = Nothing
  509. '   Wscript.Echo "End ReadCAPS_Control"
  510. 'End Sub
  511. '* Ticket: 243168, CBCAPS0004 end
  512. '*Incident # 6282 cbcaps0033, mej 02/15/2013 add department -- comment out readcaps end
  513. '* Ticket # 274098 cbcaps0016, mej 02/15/2012 begin
  514. Sub ReadEU_Group(ByVal lCity,EUGroup)
  515.    Wscript.Echo "Starting ReadEU_Group"
  516.    Const adOpenStatic = 3
  517.    Const adLockOptimistic = 3
  518.    Const adUseClient = 3
  519.    DIM objConnection
  520.    DIM objRecordset
  521.  
  522.    Set objConnection = CreateObject("ADODB.Connection")
  523.    Set objRecordset = CreateObject("ADODB.Recordset")
  524.    objConnection.Open "data source='Accounts';"
  525.    objRecordset.CursorLocation = adUseClient
  526.    objRecordset.Open "Select * from EUGroup where city = '"&lcity&"'" , objConnection, adOpenStatic, adLockOptimistic
  527. EUGroup= objRecordSet.Fields("EUGroup")
  528. wscript.echo "lcity "&lcity
  529. wscript.echo "EU Group "&EUGroup
  530.    objRecordset.Close
  531.    objConnection.Close
  532.    Set objRecordset = Nothing
  533.    Set objConnection = Nothing
  534.    Wscript.Echo "End ReadEU_Group"
  535. End Sub
  536. '* Ticket # 274098 cbcaps0016, mej 02/15/2012 end
  537. '* Ticket # 274098 cbcaps0016, mej 02/15/2012 begin
  538. 'Sub CreateNewUser(ByVal alias, ByVal ln, ByVal fn, ByVal MI, ByVal eid, ByVal etype, ByVal cc, objUser, OU, strpw,srv, mbserver, bserver, bstore,emailTo
  539. Sub CreateNewUser(ByVal alias, ByVal ln, ByVal fn, ByVal MI, ByVal eid, ByVal etype, ByVal cc,ByVal Root_DN,ByVal Emaillongbase, objUser, OU, strpw,srv, mbserver, bserver, bstore,emailTo)
  540. '* Ticket # 274098 cbcaps0016, mej 02/15/2012 end
  541.  
  542.    Wscript.Echo "Start CreateNewUser"
  543.    Const ADS_PROPERTY_DELETE = 4
  544.    Const ADS_PROPERTY_APPEND = 3
  545.    DIM objOU
  546.    DIM objGroup
  547.    DIM lcity
  548.    DIM postalcode
  549.    DIM state
  550.    DIM streetaddress
  551.    DIM telephone
  552.    DIM country
  553.    DIM officeName
  554.    DIM strMultiName
  555.    DIM strMultiDName
  556.    DIM title
  557.    DIM intPrimaryGroupToken
  558.    Dim emailAD
  559.    '* Ticket # 274098 cbcaps0016, mej 02/15/2012 begin
  560.   Dim emailbase
  561. '* Ticket # 274098 cbcaps0016, mej 02/15/2012 end
  562.   if (Len(MI) > 0) then
  563.       strMultiName = LN &"\, " &FN &" "&MI
  564.       strMultiDName = LN &", " &FN &" "&MI
  565.    else
  566.       strMultiName = LN &"\, " &FN
  567.       strMultiDName = LN &", " &FN
  568.    end if
  569.   Call ReadCostCenterTable(cc,country,lcity,postalcode,state,streetaddress,telephone,OU,officeName,srv,mbserver,bserver,bstore,emailTo)
  570.   title =GetTitle(etype)
  571.   If OU = "NewUsers" then
  572.   '* Ticket # 274098 cbcaps0016, mej 02/15/2012 begin
  573.       Set objOU = GetObject(Root_DN&"/"&OU)
  574.       'Set objOU = GetObject("LDAP://cdc-dcciberp4/OU=NewUsers,dc=ciber,dc=CBR,dc=INC")
  575. '* Ticket # 274098 cbcaps0016, mej 02/15/2012 end
  576.      Set objUser = objOU.Create("User", "cn="&strMultiName)
  577.       objUser.Put "sAMAccountName", left(alias,20)
  578.       'objUser.Put "userPrincipalName", alias &"@ciber.cbr.inc"
  579.      objUser.Put "userPrincipalName", alias &emaillongbase
  580. '      objUser.AccountDisabled = True
  581.      objUser.SetInfo
  582.   else
  583.   '* Ticket # 274098 cbcaps0016, mej 02/15/2012 begin
  584.     wscript.echo "Root_DN " &Root_DN
  585.      wscript.echo "OU " &OU
  586.       Set objOU = GetObject(Root_DN&"/"&OU)
  587.  '* Ticket # 274098 cbcaps0016, mej 02/15/2012 end
  588.     Set objUser = objOU.Create("User", "cn="&strMultiName)
  589.       objUser.Put "sAMAccountName",  left(alias,20)
  590.       objUser.Put "userPrincipalName", alias &emaillongbase '"@ciber.cbr.inc"
  591.      objUser.SetInfo
  592.       objUser.Put "co",  country
  593.       objUser.Put "c", country
  594.       objUser.Put "l",   lcity
  595.       objUser.Put "postalcode", postalcode
  596.       objUser.Put "streetAddress", streetaddress
  597.       objUser.Put "telephoneNumber", telephone
  598.       objUser.Put "PhysicalDeliveryOfficeName", cc &" - " & officeName
  599.       '* Incident # 6282 cbcaps0033, mej 02/15/2013 add department begin
  600.      objUser.Put "department", cc &" - " & officeName
  601.       '* Incident # 6282 cbcaps0033, mej 02/15/2013 add department end
  602.      objUser.Put "company", "CIBER Europe"
  603.       'objUser.Put "st", state
  604.      objUser.SetInfo
  605.  
  606.       objUser.AccountDisabled = FALSE
  607.       objUser.SetInfo
  608.       '* Ticket # 274098 cbcaps0016, mej 02/15/2012 begin
  609.     Call ReadEU_Group(lcity,EUGroup)
  610.     wscript.echo "Eu Group " &EUGroup
  611.     wscript.echo "push to group" &Root_DN&"/"&EUGroup
  612.     set objGroup = GetObject(Root_DN&"/"&EUGroup)
  613.          objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  614.          objGroup.SetInfo
  615.  
  616.       'if (lcity = "Bunnik") then
  617.       '  set objGroup = GetObject(Root_DN&"/cn=.EU Bunnik,OU=Administrative Lists & Groups,OU=CIBER Europe,dc=ciber,dc=cbr,dc=inc")
  618.       '  objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  619.       '  objGroup.SetInfo
  620.      'elseif (lcity = "Copenhagen") then
  621.       '  set objGroup = GetObject(Root_DN&"/cn=.EU Copenhagen,OU=Administrative Lists & Groups,OU=CIBER Europe,dc=ciber,dc=cbr,dc=inc")
  622.        ' objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  623.         'objGroup.SetInfo
  624.      'elseif (lcity = "Eindhoven") then
  625.       '  set objGroup = GetObject(Root_DN&"/CN=.EU Eindhoven,OU=Administrative Lists & Groups,OU=CIBER Europe,DC=ciber,DC=CBR,DC=INC")
  626.        ' objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  627.        ' objGroup.SetInfo
  628.      'elseif (lcity = "London") then
  629.       '  set objGroup = GetObject(Root_DN&"/cn=.EU London,OU=Administrative Lists & Groups,OU=CIBER Europe,dc=ciber,dc=cbr,dc=inc")
  630.        ' objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  631.         'objGroup.SetInfo
  632.      'elseif (lcity = "Nieuwegein") then
  633.       '  set objGroup = GetObject(Root_DN&"/cn=.EU Nieuwegein,OU=Administrative Lists & Groups,OU=CIBER Europe,dc=ciber,dc=cbr,dc=inc")
  634.        ' objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  635.         'objGroup.SetInfo
  636.      'elseif (lcity = "Oslo") then
  637.       '  set objGroup = GetObject(Root_DN&"/cn=.EU Oslo,OU=Administrative Lists & Groups,OU=CIBER Europe,dc=ciber,dc=cbr,dc=inc")
  638.        ' objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  639.         'objGroup.SetInfo
  640.      'elseif (lcity = "Oxford") then
  641.       '  set objGroup = GetObject(Root_DN&"/cn=.EU Oxford,OU=Administrative Lists & Groups,OU=CIBER Europe,dc=ciber,dc=cbr,dc=inc")
  642.        ' objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  643.         'objGroup.SetInfo
  644.      'elseif (lcity = "Stockholm") then
  645.       '  set objGroup = GetObject(Root_DN&"/cn=.EU Stockholm,OU=Administrative Lists & Groups,OU=CIBER Europe,dc=ciber,dc=cbr,dc=inc")
  646.        ' objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  647.         'objGroup.SetInfo
  648.      'elseif (lcity = "Barnsley") then
  649.       '  set objGroup = GetObject(Root_DN&"/cn=.EU Barnsley,OU=Administrative Lists & Groups,OU=CIBER Europe,dc=ciber,dc=cbr,dc=inc")
  650.        ' objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  651.         'objGroup.SetInfo
  652.      'elseif (lcity = "Cradley Heath") then
  653.       '  set objGroup = GetObject(Root_DN&"/cn=.EU Cradley Heath,OU=Administrative Lists & Groups,OU=CIBER Europe,dc=ciber,dc=cbr,dc=inc")
  654.        ' objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  655.         'objGroup.SetInfo
  656.      'elseif (lcity = "Grove Park") then
  657.       '  set objGroup = GetObject(Root_DN&"/cn=.EU Grove Park,OU=Administrative Lists & Groups,OU=CIBER Europe,dc=ciber,dc=cbr,dc=inc")
  658.        ' objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  659.         'objGroup.SetInfo
  660.      'elseif (cc = "CE0014") then
  661.       '  set objGroup = GetObject(Root_DN&"/cn=.EU Homeworkers,OU=Administrative Lists & Groups,OU=CIBER Europe,dc=ciber,dc=cbr,dc=inc")
  662.        ' objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  663.         'objGroup.SetInfo
  664.      'elseif (lcity = "Hinkley") then
  665.       '  set objGroup = GetObject(Root_DN&"/cn=.EU Hinckley,OU=Administrative Lists & Groups,OU=CIBER Europe,dc=ciber,dc=cbr,dc=inc")
  666.        ' objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  667.         'objGroup.SetInfo
  668.      'elseif (lcity = "Billingham") then
  669.       '  set objGroup = GetObject(Root_DN&"/cn=.EU Billingham,OU=Administrative Lists & Groups,OU=CIBER Europe,dc=ciber,dc=cbr,dc=inc")
  670.        ' objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  671.         'objGroup.SetInfo
  672.     ' elseif (lcity = "Heidelberg") then
  673.      '   set objGroup = GetObject(Root_DN&"/cn=.EU Heidelberg,OU=Administrative Lists & Groups,OU=CIBER Europe,dc=ciber,dc=cbr,dc=inc")
  674.       '  objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  675.        ' objGroup.SetInfo
  676.      'elseif (lcity = "Boeblingen") then
  677.       '  set objGroup = GetObject(Root_DN&"/cn=.EU Boeblingen,OU=Administrative Lists & Groups,OU=CIBER Europe,dc=ciber,dc=cbr,dc=inc")
  678.        ' objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  679.        ' objGroup.SetInfo
  680.      'elseif (lcity = "Cologne") then
  681.       '  set objGroup = GetObject(Root_DN&"/cn=.EU Cologne,OU=Administrative Lists & Groups,OU=CIBER Europe,dc=ciber,dc=cbr,dc=inc")
  682.        ' objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  683.         'objGroup.SetInfo
  684.      'elseif (lcity = "Zurich") then
  685.       '  set objGroup = GetObject(Root_DN&"/cn=.EU Zurich,OU=Administrative Lists & Groups,OU=CIBER Europe,dc=ciber,dc=cbr,dc=inc")
  686.        ' objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  687.         'objGroup.SetInfo
  688.      'elseif (lcity = "Prague") then
  689.       '  set objGroup = GetObject(Root_DN&"/cn=.EU Prague,OU=Administrative Lists & Groups,OU=CIBER Europe,dc=ciber,dc=cbr,dc=inc")
  690.        ' objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  691.         'objGroup.SetInfo
  692.      'elseif (lcity = "Espoo") then
  693.       '  set objGroup = GetObject(Root_DN&"/cn=.EU Espoo,OU=Administrative Lists & Groups,OU=CIBER Europe,dc=ciber,dc=cbr,dc=inc")
  694.        ' objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  695.         'objGroup.SetInfo
  696.      'elseif (lcity = "Barcelona") then
  697.       '  set objGroup = GetObject(Root_DN&"/cn=.EU Barcelona,OU=Administrative Lists & Groups,OU=CIBER Europe,dc=ciber,dc=cbr,dc=inc")
  698.        ' objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  699.         'objGroup.SetInfo
  700.      'elseif (lcity = "Madrid") then
  701.       '  set objGroup = GetObject(Root_DN&"/cn=.EU Madrid,OU=Administrative Lists & Groups,OU=CIBER Europe,dc=ciber,dc=cbr,dc=inc")
  702.        ' objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  703.         'objGroup.SetInfo
  704.      'elseif (lcity = "Zaragoza") then
  705.       '  set objGroup = GetObject(Root_DN&"/cn=.EU Zaragoza,OU=Administrative Lists & Groups,OU=CIBER Europe,dc=ciber,dc=cbr,dc=inc")
  706.        ' objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  707.         'objGroup.SetInfo
  708.      'elseif (lcity = "Singapore") then
  709.       '  set objGroup = GetObject(Root_DN&"/cn=.EU Singapore,OU=Administrative Lists & Groups,OU=CIBER Europe,dc=ciber,dc=cbr,dc=inc")
  710.        ' objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  711.        ' objGroup.SetInfo
  712.      'elseif (lcity = "Shanghai") then
  713.       '  set objGroup = GetObject(Root_DN&"/cn=.EU Shanghai,OU=Administrative Lists & Groups,OU=CIBER Europe,dc=ciber,dc=cbr,dc=inc")
  714.        ' objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  715.        ' objGroup.SetInfo
  716.      'elseif (lcity = "Harefield") then
  717.       '  set objGroup = GetObject(Root_DN&"/cn=.EU Harefield,OU=Administrative Lists & Groups,OU=CIBER Europe,dc=ciber,dc=cbr,dc=inc")
  718.        ' objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  719.         'objGroup.SetInfo
  720.      'elseif (lcity = "Langenfeld") then
  721.       '  set objGroup = GetObject(Root_DN&"/cn=.EU Langenfeld,OU=Administrative Lists & Groups,OU=CIBER Europe,dc=ciber,dc=cbr,dc=inc")
  722.        ' objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  723.         'objGroup.SetInfo
  724.      'elseif (lcity = "Vienna") then
  725.       '  set objGroup = GetObject(Root_DN&"/cn=.EU Vienna,OU=Administrative Lists & Groups,OU=CIBER Europe,dc=ciber,dc=cbr,dc=inc")
  726.        ' objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  727.         ' objGroup.SetInfo
  728.      'elseif (lcity = "St. Petersburg") then
  729.       '  set objGroup = GetObject(Root_DN&"/cn=.EU St. Petersburg,OU=Administrative Lists & Groups,OU=CIBER Europe,DC=ciber,DC=CBR,DC=INC")
  730.        ' objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  731.         'objGroup.SetInfo
  732.      'elseif (lcity = "Auckland") then
  733.       '  set objGroup = GetObject(Root_DN&"/cn=.EU Auckland,OU=Administrative Lists & Groups,OU=CIBER Europe,dc=ciber,dc=cbr,dc=inc")
  734.        ' objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  735.         'objGroup.SetInfo
  736.      'elseif (lcity = "Moscow") then
  737.     'set objGroup = GetObject(Root_DN&"/cn=.EU Moscow,OU=Administrative Lists & Groups,OU=CIBER Europe,dc=ciber,dc=cbr,dc=inc")
  738.     'objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  739.     'objGroup.SetInfo
  740.      'elseif (lcity = "Melbourne") then
  741.     'set objGroup = GetObject(Root_DN&"/cn=.EU Melbourne,OU=Administrative Lists & Groups,OU=CIBER Europe,dc=ciber,dc=cbr,dc=inc")
  742.     'objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  743.     'objGroup.SetInfo
  744.      'elseif (lcity = "North Sydney") then
  745.       '  set objGroup = GetObject(Root_DN&"/cn=.EU Sydney,OU=Administrative Lists & Groups,OU=CIBER Europe,dc=ciber,dc=cbr,dc=inc")
  746.        ' objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  747.         ' objGroup.SetInfo
  748.     'Call#          : 46332 (Modify CIBER Europe New Hire account script)
  749.     'Modified on    : 4/5/2006
  750.     'Modified by    : Ashok Gopalan
  751.     'Notes          : Add users belonging to Amsterdam to the corresponding  distribution group.
  752.     '   elseif (lcity = "Amsterdam") then
  753.     '       set objGroup = GetObject(Root_DN&"/cn=.EU Amsterdam,OU=Administrative Lists & Groups,OU=CIBER Europe,DC=ciber,DC=CBR,DC=INC")
  754.     '       objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  755.     '       objGroup.SetInfo
  756.      'else
  757.      'end if
  758.      '* Ticket # 274098 cbcaps0016, mej 02/15/2012 end
  759.      if (cc <> "04149") then
  760.     Call ReadEU_Group("Europe",EUGroup)
  761.     wscript.echo "Eu Group " &EUGroup
  762.     set objGroup = GetObject(Root_DN&"/"&EUGroup)
  763.     'set objGroup = GetObject("&Root_DN&"/cn=CS CIBER Europe,cn=Users,dc=ciber,dc=cbr,dc=inc")
  764.         objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  765.          objGroup.SetInfo
  766.      '* Ticket # 274098 cbcaps0016, mej 02/15/2012 begin
  767.        'set objGroup = GetObject(Root_DN&"/cn=CS CIBER Europe,cn=Users,dc=ciber,dc=cbr,dc=inc")
  768.        'objGroup.PutEx ADS_PROPERTY_APPEND,  "member", Array(objuser.Get("distinguishedName"))
  769.        'objGroup.SetInfo
  770.     '* Ticket # 274098 cbcaps0016, mej 02/15/2012 end
  771.      end if
  772.      'Removed by Al -- See Call # 35106
  773.     'Set objGroup = GetObject(Root_DN&"/cn=CSP AllEmps,cn=Users,dc=ciber,dc=cbr,dc=inc")
  774.     'objGroup.PutEx ADS_PROPERTY_APPEND, "member", Array(objuser.Get("distinguishedName"))
  775.     'objGroup.SetInfo
  776.      Set objGroup = Nothing
  777.   end if
  778.   strpw = CreatePassword(eid,cc)
  779. Wscript.Echo eid
  780. Wscript.Echo etype
  781. Wscript.Echo ln
  782. Wscript.Echo fn
  783. Wscript.Echo strMultiDName
  784.   objUser.EmployeeID = eid
  785.   objUser.EmployeeType = etype
  786.   objUser.LastName = ln
  787.   objUser.FirstName = fn
  788.   if (Len(mi) > 0) then
  789.      objUser.Put "initials", left(mi,1)
  790.   end if
  791.   objUser.DisplayName = strMultiDName
  792.   objUser.Description = eid & " - " & title
  793.   objUser.SetPassword strpw
  794.   objUser.SetInfo
  795.   '* Ticket # 274098 cbcaps0016, mej 02/15/2012 begin
  796.  'emailad = alias & ".ciber.com"
  797.  emailad = alias & emailbase
  798.   '* Ticket # 274098 cbcaps0016, mej 02/15/2012 end
  799.  Call UpdateHeatProfile(eid,fn,ln,telephone,(cc &" - " & officeName),emailad,alias,etype,(eid & " - " & title))
  800.   set objGroup = Nothing
  801.   set objOU = Nothing
  802.   Wscript.Echo "End CreateNewUser"
  803. End Sub
  804.  
  805. '*  Subroutine UpdateHeatProfile--Subroutine to create the users in the Heat Help Desk System
  806. '*
  807. '*  Input:
  808. '*          Empid--employee ID, string
  809. '*          firstname--firstname, string
  810. '*          lastname--lastname, string
  811. '*          phone--Office phone, string
  812. '*          Department--PhyicalOfficeDeliveryName, string
  813. '*          EmailID--email address, string
  814. '*          Logon--username, string
  815. '*          JobCode--employeeType, string
  816. '*          Description--Description, string
  817. '*
  818. '*  Added:  June 9, 2005, by Jeffrey Lathrop
  819.  
  820. Sub UpdateHeatProfile(byVal empid, byVal firstname,byVal lastname,byVal phone, byVal department, byVal EmailID,byVal Logon, byVal JobCode, byVal Description)
  821.   wscript.echo "Start UpdateHeatProfile"
  822.   Dim vbquote
  823.   Dim costcenter
  824.   Dim jobclass
  825.   Dim strDate
  826.   Dim strTime
  827.   Dim SLAClass
  828.   Dim hSqlConn
  829.   Dim hSqlCommand
  830.   yy = Year(Date)
  831.   mm = Month(date)
  832.   dd = Day(date)
  833.   If (mm < 10) Then
  834.     mm = "0" &mm
  835.   End If
  836.   If (dd < 10) Then
  837.     dd = "0"&dd
  838.   End If
  839.   strdate = yy&"-"&mm&"-"&dd
  840.   strtime = time
  841. '*  Ticket: 243168, CBCAPS0004 trim am/pm for heat begin
  842.  strtime = left(strtime,8)
  843. '*  Ticket: 243168, CBCAPS0004 end
  844.  costcenter = left(department,2)
  845.   jobclass = Mid(jobcode, 2,1)
  846.   vbquote = chr(34)
  847.   If (((costcenter = "08") or (costcenter = "03")) and (jobclass = "11")) Then
  848.     SLAClass = "Silver"
  849.   elseif ((jobclass <> "11") and (jobclass <> "17")) then
  850.     SLAClass = "Silver"
  851.   else
  852.     SLAClass = "Bronze"
  853.   End If
  854.   Set hSqlConn = CreateObject("ADODB.Connection")
  855.       hSQLConn.Open "data source='Heat Live';"
  856.   Set hSqlCommand = CreateObject("ADODB.Command")
  857.   hSqlCommand.ActiveConnection = hSqlConn
  858.   hSqlCommand.CommandText = ("Select * from Profile where custid = '"&empid&"'")
  859.   set objRecordSet = hSqlCommand.Execute
  860.   If objRecordSet.EOF Then
  861.     hSqlCommand.CommandText = ("Set Quoted_Identifier OFF  Insert into Profile (CustID, CustType,FirstName,LastName,Phone,Department,EmailID,Modby,ModDate,ModTime,SLAClass,RecvdDate,RecvdTime,Login,JobCode,Description) " _
  862.                                &"Values('"&empid &"','Employee',"&vbquote&firstName&vbquote&","&vbquote&LastName&vbquote&","&vbquote&phone&vbquote&",'" _
  863.                                &Department&"',"&vbquote&EmailID&vbquote&",'Accountscript','"&strdate&"','"&strtime&"','"&SLAClass&"','"&strdate&"','"&strtime&"',"&vbquote&Logon&vbquote&",'"&Jobcode&"','"&description&"')")
  864.     hSqlCommand.Execute
  865.   End If
  866.   wscript.echo "End UpdateHeatProfile"
  867. End Sub
  868.  
  869. Sub CreateMailBox(ByVal aliasNB, ByVal aliasB, ByVal cc, ByVal etype, objUser, cmbServer, cmbStore)
  870.    WScript.Echo "Start CreateMailBox"
  871.    DIM cmsrv, cmstore, cmstoregrp,cmadmingrp
  872.    DIM cdPerson
  873.    set cdPerson = CreateObject("CDO.Person")
  874.    set cdPerson = objuser
  875.    cdPerson.MailEnable aliasB
  876.    cdPerson.SetInfo
  877.    '* Ticket # 274098 cbcaps0016, mej 02/15/2012 begin
  878. '   cdPerson.Put "proxyAddresses", Array("smtp:"&aliasNB&emailbase"@ciber.com","SMTP:"&aliasB)
  879.   cdPerson.Put "proxyAddresses", Array("smtp:"&aliasNB&emailbase,"SMTP:"&aliasB)
  880. '* Ticket # 274098 cbcaps0016, mej 02/15/2012 end
  881.   cdPerson.SetInfo
  882.    set cdPerson = Nothing
  883.    Wscript.Echo "End CreateMailBox"
  884. End Sub
  885. '* Incident # 5937 cbcaps0030, mej 11/05/2013 use exchange 2010 calls begin
  886. '* new emailadmin routine
  887. Sub EmailAdmin(ByVAl emailext, ByVal aliasB, ByVal ln, ByVal fn, ByVal mi, ByVal eid, ByVal etype, ByVal cc, ByVal strpwd, ByVal mbserver, ByVal emailto,ByVal FQDN, ByVal Root_DN, ByVal EmailFromStatic, ByVal EmailToStatic, ByVal EmailServer, ByVal EmailBase)
  888.    Wscript.Echo "Start EmailAdmin"
  889.    
  890.    Dim messageBody
  891.    Dim messageBody1
  892.    Dim messageBody2
  893.    Dim strCBRSP
  894.  
  895.    messagebody1 = "WELCOME TO Ciber" & VbCrLF
  896.    messagebody1 = messagebody1 & "The Ciber Service Desk would like to take this opportunity to welcome you to Ciber. "
  897.    messagebody1 = messagebody1 & "At this time we encourage you to take advantage of the IS related services, which we offer."  & VbCrLF & VbCrLF
  898.    
  899.    messagebody1 = messagebody1 & "Ciber NETWORK ACCESS:" & VbCrLF
  900.    messagebody1 = messagebody1 & vbTab & "Ciberspace username: " & aliasB &VbCrLF
  901.    messagebody1 = messagebody1 & vbTab & "Ciberspace password: " & strpwd &VbCrLF
  902.    messagebody1 = messagebody1 & vbTab & "Email Address: " &aliasB & "@Ciber.com" & VbCrLF & VbCrLF
  903.    messagebody1 = messagebody1 & "Forwarded Email Address: " & emailext & VbCrLF & VBCrLF
  904.  
  905.    messagebody1 = messagebody1 & "Ciber Europe IT Security Handbook:" & VbCrLF
  906.    messagebody1 = messagebody1 & vbTab & "Ciber Europe IT Security Handbook" & VbCrLF
  907.    messagebody1 = messagebody1 & vbTab & "URL:   https://Ciberspace.Ciber.com/sites/europe/All%20Knowledge/IT%20Security%20Handbook.aspx"  & VbCrLF & VbCrLF
  908.  
  909.    messagebody1 = messagebody1 & "Ciberspace: " & VbCrLF  
  910.    messagebody1 = messagebody1 & vbTab & "Ciberspace URL:   http://Ciberspace.Ciber.com"  & VbCrLF & VbCrLF
  911.    
  912.      
  913.    messagebody1 = messagebody1 & "Once you login to Ciberspace, you will find Links for enterprise applications under 'System Links'. " & VbCrLF
  914.    messagebody1 = messagebody1 & "Password Self Service: " & VbCrLF
  915.    messagebody1 = messagebody1 & vbTab & "Password Self Service URL:  https://password.ciber.com " & VbCrLF & VbCrLF
  916.  
  917.    messagebody1 = messagebody1 & "Your password will expire every 90 days. In order to not lose access to Ciber resources please change your password before the 90 day expiration. In addition, you will " & VbCrLF
  918.    messagebody1 = messagebody1 & "receive an email from the Ciber Service Desk 14 days prior to the network account password expiration, to ensure that you are alerted of the necessary password change requirement. " & VbCrLF & VbCrLF
  919.  
  920.    messagebody1 = messagebody1 & "Enroll in Password Self-Service: " & VbCrLF
  921.    messagebody1 = messagebody1 & "Login with your Ciber-COM account and begin the enrollment process. " & VbCrLF
  922.    messagebody1 = messagebody1 & vbTab & "1. Click on the link:  https://password.ciber.com.    (Site can be accessed from Outside of Ciberspace.) " & VbCrLF
  923.    messagebody1 = messagebody1 & vbTab & "2. Enter your Ciber-COM username and password, same as Ciberspace. " & VbCrLF
  924.    messagebody1 = messagebody1 & vbTab & "3. Select your questions and answers.  Don't forget your answers, they are CASE sensitive!  These same questions will be asked each time you access the site to reset your password. " & VbCrLF
  925.    messagebody1 = messagebody1 & vbTab & "4. If you happen to forget your answers then you can always log in and select your questions and answers again, as long as your password hasn't expired. " & VbCrLF
  926.    messagebody1 = messagebody1 & vbTab & "5. Once you are enrolled you will receive notices informing you that your password is going to expire within 14 days of the 90 day deadline. " & VbCrLF
  927.    messagebody1 = messagebody1 & vbTab & "6. You may go in and change your Question and Answers at any time as long as your password is still valid. " & VbCrLF & VbCrLF
  928.  
  929.    messagebody1 = messagebody1 & "Change Password: " & VbCrLF
  930.    messagebody1 = messagebody1 & "To reset your Ciber password, simply follow these steps.  (Note: Users must be enrolled before they can reset their passwords) " & VbCrLF
  931.    messagebody1 = messagebody1 & vbTab & "1. Click on the link:  https://password.ciber.com.  Site can be access from outside of Ciberspace. " & VbCrLF
  932.    messagebody1 = messagebody1 & vbTab & "2. Click on the RESET YOUR PASSWORD link. " & VbCrLF
  933.    messagebody1 = messagebody1 & vbTab & "3. Enter your domain user name.  This is the user name that is used for Ciberspace. " & VbCrLF
  934.    messagebody1 = messagebody1 & vbTab & "4. Answer the questions chosen at the time of enrollment.  Remember your answers are CASE sensitive and you need to answer the question the same way that it was typed in. " & VbCrLF
  935.    messagebody1 = messagebody1 & vbTab & "5. (If your answers do not take and your password hasn't expired.  Then go back to the enrollment instructions and re-enter new Questions and Answers.) " & VbCrLF
  936.    messagebody1 = messagebody1 & vbTab & "6. Must enter in the Word Verification at the bottom of page.  (This is to ensure that the response isn't computer generated. " & VbCrLF
  937.    messagebody1 = messagebody1 & vbTab & "7. Enter your new password based on the following password requirements.  (Note: The complexity requirements are not displayed in detail on the site at this time) " & VbCrLF
  938.    messagebody1 = messagebody1 & vbTab & vbTab & "a. Password must not contain the user's account name or parts of the user's full name that exceed two consecutive characters " & VbCrLF
  939.    messagebody1 = messagebody1 & vbTab & vbTab & "b. Must be at least eight (8) characters in length " & VbCrLF
  940.    messagebody1 = messagebody1 & vbTab & vbTab & "c. Must contain characters from at least three of the following four categories: " & VbCrLF
  941.    messagebody1 = messagebody1 & vbTab & vbTab & vbTab & "English uppercase characters    (A through Z) " & VbCrLF
  942.    messagebody1 = messagebody1 & vbTab & vbTab & vbTab & "English lowercase characters    (a through z) " & VbCrLF
  943.    messagebody1 = messagebody1 & vbTab & vbTab & vbTab & "Base 10 digits                  (0 through 9) " & VbCrLF
  944.    messagebody1 = messagebody1 & vbTab & vbTab & vbTab & "Non-alphabetic characters       (such as !, $, #, %, *) " & VbCrLF
  945.    messagebody1 = messagebody1 & vbTab & "8. Once again enter in the Word Verification at the bottom of the page.  (This is to ensure that the response isn't computer generated.) " & VbCrLF
  946.    messagebody1 = messagebody1 & vbTab & "9. Click RESET PASSWORD " & VbCrLF & VbCrLF
  947.  
  948.    messagebody1 = messagebody1 & "Ciber Service Desk - Hours of Operation: " & VbCrLF
  949.    messagebody1 = messagebody1 & "The Service Desk hours are 24 hours Monday through Friday. You can contact the Service Desk by emailing support@ciber.com or calling the following numbers: " & VbCrLF  & VbCrLF
  950.    messagebody1 = messagebody1 & "Europe - 00800 3000 5566 " & VbCrLF & VbCrLF
  951.    messagebody1 = messagebody1 & "India - +91 80 6699 0555 " & VbCrLF & VbCrLF
  952.    messagebody1 = messagebody1 & "Australia - 180 007 3072 " & VbCrLF & VbCrLF
  953.    messagebody1 = messagebody1 & "New Zealand - 800 448 869. " & VbCrLF  & VbCrLF
  954.    messagebody1 = messagebody1 & "Voice mail is available after hours. " & VbCrLF
  955.  
  956.    messagebody1 = messagebody1 & "Sincerely, " & VbCrLF & VbCrLF
  957.    messagebody1 = messagebody1 & "Ciber Service Desk " & VbCrLF & VbCrLF
  958.    messagebody1 = messagebody1 & "Hours: Mon-Fri 24 hours " & VbCrLF & VbCrLF
  959.    messagebody1 = messagebody1 & "Toll Free (US) - (888) 773-2778 " & VbCrLF  & VbCrLF
  960.    messagebody1 = messagebody1 & "Europe - 00800 3000 5566 " & VbCrLF & VbCrLF
  961.    messagebody1 = messagebody1 & "India - +91 80 6699 0555 " & VbCrLF & VbCrLF
  962.    messagebody1 = messagebody1 & "Australia - 180 007 3072 " & VbCrLF & VbCrLF
  963.    messagebody1 = messagebody1 & "New Zealand - 800 448 869 " & VbCrLF & VbCrLF
  964.    messagebody1 = messagebody1 & "Email - Support@ciber.com  " & VbCrLF & VbCrLF
  965.    messagebody1 = messagebody1 & "Ciberspace Site - https://ciberspace.ciber.com/sites/IS/  " & VbCrLF
  966.  
  967.    messagebody = messageBody1
  968.  
  969.    Set objEmail = CreateObject("CDO.Message")
  970.    objEmail.From = EmailFromStatic
  971.    objEmail.To = emailto &";"&emailtostatic
  972.    objEmail.Subject = "New User Information: " & ln & ", " & fn
  973.    objEmail.Textbody = messageBody
  974.    objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
  975.    objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = emailserver
  976.    objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
  977.    objEmail.Configuration.Fields.Update
  978.    objEmail.Send
  979.    Wscript.Echo "End EmailAdmin"
  980. End Sub
  981. '* Incident # 5937 cbcaps0030, mej 11/05/2013 use exchange 2010 calls end new sub emailadmin
  982. '* Incident # 5937 cbcaps0030, mej 11/05/2013 use exchange 2010 calls begin rename old emailadmin routine
  983. '* Ticket # 274098 cbcaps0016, mej 02/15/2012 begin
  984. 'Sub EmailAdmin(aliasNB, aliasB, ln, fn, mi, eid, etype, cc,strpwd, mbserver,emailto)
  985. 'Sub EmailAdmin(aliasNB, aliasB, ln, fn, mi, eid, etype, cc,strpwd, mbserver,emailto,emailserver)
  986. '* Ticket # 274098 cbcaps0016, mej 02/15/2012 end
  987. Sub EmailAdmin_11052013(ByVAl aliasNB, ByVal aliasB, ByVal ln, ByVal fn, ByVal mi, ByVal eid, ByVal etype, ByVal cc, ByVal strpwd, ByVal mbserver, ByVal emailto,ByVal FQDN, ByVal Root_DN, ByVal EmailFromStatic, ByVal EmailToStatic, ByVal EmailServer, ByVal EmailBase)
  988.    Wscript.Echo "Start EmailAdmin"
  989.    
  990.    Dim messageBody
  991.    Dim messageBody1
  992.    Dim messageBody2
  993.    Dim strCBRSP
  994.  
  995.    messagebody1 = "WELCOME TO CIBER" & VbCrLF
  996.    messagebody1 = messagebody1 & "The CIBER Help Desk would like to take this opportunity to welcome you to CIBER. "
  997.    messagebody1 = messagebody1 & "At this time we encourage you to take advantage of the IS related services, which we offer."  & VbCrLF & VbCrLF
  998.    messagebody1 = messagebody1 & "The password below will expire after 90 days" & VbCrLF & VbCrLF
  999.    
  1000.    messagebody1 = messagebody1 & "PASSWORD REQUIREMENTS:" & VbCrLF
  1001.    messagebody1 = messagebody1 & "Password needs to be at least eight characters; Has not been used in the previous four passwords; Does not contain your account or full name; Contains at least three of the four character groups:"  & VbCrLF
  1002.    messagebody1 = messagebody1 & vbTab & "English uppercase characters  (A through Z)" & VbCrLF
  1003.    messagebody1 = messagebody1 & vbTab & "English lowercase characters  (a through z)" & VbCrLF
  1004.    messagebody1 = messagebody1 & vbTab & "Numerals              (0 through 9)" & VbCrLF
  1005.    messagebody1 = messagebody1 & vbTab & "Non-alphabetic characters (such as !, $, #, %, *)" & VbCrLF & VbCrLF   
  1006.    messagebody1 = messagebody1 & "Your Username and Password will give you access to the following resources where you will find link to 'Change Password'." & VbCrLF & VbCrLF
  1007.    
  1008.    messagebody1 = messagebody1 & "CIBER NETWORK ACCESS:" & VbCrLF
  1009.    messagebody1 = messagebody1 & vbTab & "CIBERspace username: " & aliasNB &VbCrLF
  1010.    messagebody1 = messagebody1 & vbTab & "CIBERspace password: " & strpwd &VbCrLF
  1011.    messagebody1 = messagebody1 & vbTab & "Email Address: " &aliasNB & "@ciber.com" & VbCrLF & VbCrLF
  1012.    messagebody1 = messagebody1 & "Forwarded Email Address: " & aliasB & VbCrLF & VBCrLF
  1013.    
  1014.    strCBRsp = "CIBERSPACE: " & VbCrLF  
  1015.    strCBRsp = strCBRsp & vbTab & "CIBERspace URL:   http://ciberspace.ciber.com"  & VbCrLF & VbCrLF    
  1016.  
  1017.    messagebody1 = messagebody1 & "CIBER Europe IT Security Handbook:" & VbCrLF
  1018.    messagebody1 = messagebody1 & vbTab & "CIBER Europe IT Security Handbook URL:   https://ciberspace.ciber.com/sites/europe/All%20Knowledge/IT%20Security%20Handbook.aspx"  & VbCrLF & VbCrLF
  1019.  
  1020.    messagebody2 = messagebody2 & "CIBER Help Desk - Hours of Operation:" & VbCrLF
  1021.    messagebody2 = messagebody2 & "The Help Desk hours are 6:00 a.m. Mountain time to 6:00 p.m. Mountain time. You can contact the Help Desk at 1-888-773-2778 or submit a support request at https://helpdesk.ciber.com. Voice mail is available after hours." & VbCrLF
  1022.    messagebody2 = messagebody2 & "In the case of a site emergency, the On-Call pager number is 303-807-9787." & VbCrLF & VbCrLF
  1023.    messagebody2 = messagebody2 & "Your password will expire every 90 days. In order not to lose access to CIBER IS resources please change your password before the 90 day expiration. "
  1024.    
  1025.    'check if this a subcontractor with CC in the format "x17xxx"
  1026.   if (Len(cc) >= 3) then
  1027.       if (Mid(cc, 2, 2) <> "17") then  
  1028.          messagebody2 = messagebody2 & "In addition, you will receive an email from the CIBER Help Desk, 14 days prior to the network account password expiration, to ensure that you are alerted of the necessary password change requirement. "
  1029.       end if   
  1030.    end if
  1031.    
  1032.    messagebody2 = messagebody2 & VbCrLF & VbCrLF & "CIBER Help Desk" & VbCrLF
  1033.    messagebody2 = messagebody2 & "PH: 888-773-2778" & VbCrLF
  1034.    messagebody2 = messagebody2 & "E-Mail: helpdesk@ciber.com" & VbCrLF
  1035.    messagebody2 = messagebody2 & "Web: https://helpdesk.ciber.com" & VbCrLF
  1036.    
  1037.    messagebody = messageBody1 & strCBRsp & messageBody2
  1038.  
  1039.     Set objEmail = CreateObject("CDO.Message")
  1040. '* Ticket # 274098 cbcaps0016, mej 02/15/2012 begin
  1041. '   objEmail.From = "HelpDesk@ciber.com"
  1042.    objEmail.From = EmailFromStatic
  1043. '   objEmail.To = emailto &";new_accounts@ciber.com"
  1044.    objEmail.To = emailto &";"&emailtostatic
  1045. '* Ticket # 274098 cbcaps0016, mej 02/15/2012 end
  1046.     objEmail.Subject = "New User Information: " & ln & ", " & fn
  1047.     objEmail.Textbody = messageBody
  1048.     objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
  1049.     '* Ticket # 274098 cbcaps0016, mej 02/15/2012 begin
  1050.   'objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.ciber.com"
  1051.    objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = emailserver
  1052.     '* Ticket # 274098 cbcaps0016, mej 02/15/2012 end
  1053.    objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
  1054.     objEmail.Configuration.Fields.Update
  1055.     objEmail.Send
  1056.     Wscript.Echo "End EmailAdmin"
  1057. End Sub
  1058. '* Incident # 5937 cbcaps0030, mej 11/05/2013 use exchange 2010 calls end rename emailadmin routine
  1059. Sub EmailAdmin_old(aliasNB, aliasB, ln, fn, mi, eid, etype, cc,strpwd, mbserver,emailto)
  1060.    Wscript.Echo "Start EmailAdmin"
  1061.    DIM messageBody
  1062.    DIM messageBody1
  1063.    DIM messageBody2
  1064.    DIM messageBody3
  1065.    DIM messageBody4
  1066.    DIM messageBody5
  1067.    DIM strCBRSP
  1068.    DIM strCHpt
  1069.    DIM strOWA
  1070.    DIM strusrnm
  1071.    DIM strusrpw
  1072.    messagebody1 = "Welcome To CIBER" &VbCrLF &"The CIBER Help Desk would like to take this opportunity to welcome you to CIBER."
  1073.    messagebody2 = " At this time we encourage you to take advantage of the IT related services, which we offer.  Your UserName and Password will give you access to the following resources."  &VbCrLF &VbCrLF
  1074.    messagebody3  = "CIBER NETWORK:"  &VbCrLF &VbCrLF &"CIBERspace username: "
  1075.    messagebody4 = aliasNB &VbCrLF
  1076.    messagebody5 = "CIBERspace password: " &strpwd &VbCrLF
  1077.    messagebody6 = "Email Address: " &aliasNB &"@ciber.com" &VbCrLF&VbCrLF
  1078.    messagebody7 = "Forwarded Email Address: " &aliasB &VbCrLF
  1079.    strCBRsp = VBCrLF & "CIBERSPACE: " &VbCrLF &VbCrLF &"     CIBERspace URL:         https://ciberspace.ciber.com"  &VbCrLF
  1080.    strhd1 = VbCrLF & "CIBER Help Desk:" &VbCrLF &VbCrLF &"The Help Desk hours are 6:00 a.m. Mountain time to 6:00 p.m. Mountain time.  You can contact the Help Desk at 1-888-773-2778 or send an email to helpdesk@ciber.com.  Voice mail is available after hours." &VbCrLF &VbCrLF
  1081.    strhd2 = "In the case of a site emergency, the On-Call pager number is 303-609-7577." &VbCrLF &VbCrLF &"CIBER Help Desk" &VbCrLF &"PH:  888-773-2778" &VbCrLF &"E-Mail:  helpdesk@ciber.com"
  1082.  
  1083.     messagebody = messageBody1 & messagebody2 &messagebody3 & messagebody4 & messagebody5 &messagebody6 &messagebody7 &strCBRsp &strhd1 &strhd2
  1084. '* Ticket # 274098 cbcaps0016, mej 02/15/2012 begin
  1085. Emailstore = emailto &";"&emailtostatic
  1086. '* Ticket # 274098 cbcaps0016, mej 02/15/2012 end
  1087. Set objEmail = CreateObject("CDO.Message")
  1088. '* Ticket # 274098 cbcaps0016, mej 02/15/2012 begin
  1089. 'objEmail.From = "HelpDesk@ciber.com"
  1090.    objEmail.From = EmailFromStatic
  1091.     'objEmail.To = emailto &";new_accounts@ciber.com;" &aliasB
  1092.    objEmail.To = emailto &";"&emailtostatic &aliasB
  1093. '* Ticket # 274098 cbcaps0016, mej 02/15/2012 end
  1094.    objEmail.Subject = "New User Information: " & ln &", " &fn
  1095.     objEmail.Textbody = messageBody
  1096.     objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
  1097. '* Ticket # 274098 cbcaps0016, mej 02/15/2012 begin
  1098. '    objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.ciber.com"
  1099.    objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = emailserver
  1100.  '* Ticket # 274098 cbcaps0016, mej 02/15/2012 end
  1101.    objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
  1102.     objEmail.Configuration.Fields.Update
  1103.     objEmail.Send
  1104.     Wscript.Echo "End EmailAdmin"
  1105. End Sub
  1106.  
  1107. Sub WriteLog(aliasNB, aliasB,ln,fn,mi, eid, etype, cc,strpwd, OU,StatusB, StatusNB)
  1108.   WScript.Echo "Start WriteLog"
  1109.   Const ForAppending = 8
  1110.   DIM Outfso
  1111.   DIM Myfout
  1112.   '* Create Files System Object for writing output to file append
  1113.  Set Outfso = CreateObject("Scripting.FileSystemObject")
  1114.   Set Myfout = OutFSO.OpenTextFile("c:\newaccounts.txt", ForAppending)
  1115.   if (StatusNB <> "Name too Long") then
  1116.        if (StatusNB = "OK") then
  1117.        '* Ticket # 274098 cbcaps0016, mej 02/15/2012 begin
  1118.       '  Myfout.Writeline aliasNB &"," &aliasB &"," &strpwd&","&cc&","&etype&"," &eid &","&aliasNB&"@ciber.com,Created in this OU: "&OU
  1119.         Myfout.Writeline aliasNB &"," &aliasB &"," &strpwd&","&cc&","&etype&"," &eid &","&aliasNB&emailbase&",Created in this OU: "&OU
  1120.  '* Ticket # 274098 cbcaps0016, mej 02/15/2012 end
  1121.         Wscript.Echo  aliasNB &"," &aliasB &"," &strpwd&","&cc&","&etype&"," &eid &",Created in this OU: "&OU
  1122.        else
  1123.          Myfout.Writeline  Ln &"," &fn & ",,,"&eid &",User already exists"
  1124.          Wscript.Echo Ln &"," &fn & ",,,"&eid &",User already exists"
  1125.        end if
  1126.   else
  1127.     Myfout.Writeline  Ln &"," &fn & ",," &cc &","&etype&","&eid &",Name too Long"
  1128.     Wscript.Echo  Ln &"," &fn & ",," &cc &","&etype&","&eid &",Name too Long"
  1129.   End if
  1130.   Myfout.Close
  1131.   set Myfout = Nothing
  1132.   set Outfso = Nothing
  1133.   Wscript.Echo "End WriteLog"
  1134. End Sub
  1135.  
  1136. Sub Main()
  1137. '* Variable Listing
  1138.  
  1139. '*Const ADS_GROUP_TYPE_GLOBAL_GROUP = &h2
  1140. '*Const ADS_GROUP_TYPE_LOCAL_GROUP = &h4
  1141. '*Const ADS_GROUP_TYPE_UNIVERSAL_GROUP = &h8
  1142. '*Const ADS_GROUP_TYPE_SECURITY_ENABLED = &h80000000
  1143.  
  1144. '* Incident # 6282 cbcaps0033, mej 02/15/2013 add department begin
  1145. '* note use include sub routine
  1146. '* note use full path for SSIS package runs
  1147. includeFile "CB_Read_CAPS_Control.vbs"
  1148. includeFile "CB_Read_CAPS_EmailControl.vbs"
  1149. includeFile "CB_Send_CAPS_Email.vbs"
  1150. '*includeFile "D:\Adscripts\CB_Read_CAPS_Control.vbs"
  1151. '*includeFile "D:\Adscripts\CB_Read_CAPS_EmailControl.vbs"
  1152. '*includeFile "D:\Adscripts\CB_Send_CAPS_Email.vbs"
  1153. '* Incident # 6282 cbcaps0033, mej 02/15/2013 add department end
  1154.  
  1155.  
  1156. Const ADS_UF_ACCOUNTDISABLE = 2
  1157. Const ADS_CHASE_REFERRALS_SUBORDINATE = &h20
  1158. DIM vbQuote                                          '* Double Quote Character
  1159. DIM fso                                              '* File system object
  1160. DIM MyFile                                           '* Program Instance of FSO to write data out to
  1161. DIM MyFile2
  1162. DIM objConnection                                    '* Active Directory connection
  1163. DIM objCommand                                       '* Search Command
  1164. DIM objRecordSet                                     '* Returned records
  1165. DIM objUser                                          '* User record information structure
  1166. DIM strdept                                          '* string Department
  1167. DIM cc                                               '* cost center
  1168. DIM ln                                               '* last name
  1169. DIM fn                                               '* first name
  1170. DIM mi                                               '* middle initials
  1171. DIM eid                                              '* employee ID
  1172. DIM etype                                            '* employee Type
  1173. DIM aliasNB                                          '* NonBillable alias
  1174. DIM aliasB                                           '* Billable Alias
  1175. DIM OU                                               '* Organizational unit
  1176. DIM strpw                                            '* Security authorization container
  1177. DIM arrServiceList                                   '* Array of Parsed information
  1178. DIM Server                                           '* Branch Server
  1179. DIM mbserver                                         '* NonBillable Mailserver
  1180. DIM bserver                                          '* Billable Mailserver
  1181. DIM bstore                                           '* Billable Store
  1182. DIM emailto                                          '* admins to mail information to
  1183. DIM StatusB
  1184. DIM StatusNB
  1185. DIM jobtype1
  1186. DIM jobtype2
  1187. DIM alias1, alias2
  1188. DIM status1, status2
  1189. '* Ticket # 274098 cbcaps0016, mej 02/15/2012 begin
  1190.     Dim FQDN, Root_DN
  1191. Dim EmailToStatic, EmailToStatic2, EmailFromStatic, EmailBase, EmailLongBase, EmailServer, group_base
  1192. '* Incident # 5937 cbcaps0030, mej 11/05/2013 use exchange 2010 calls begin
  1193.     Dim Region, MailType, LookupErr, MaxTries, MaxCount
  1194. '* Incident # 5937 cbcaps0030, mej 11/05/2013 use exchange 2010 calls end
  1195.  
  1196. call ReadCAPS_Control("group_base",capsvaluedesc)
  1197. wscript.echo "capsvaluedesc " &capsvaluedesc
  1198. group_base = capsvaluedesc
  1199. '******************
  1200. call ReadCAPS_Control("EmailToStatic",capsvaluedesc)
  1201. wscript.echo "capsvaluedesc " &capsvaluedesc
  1202. EmailToStatic = capsvaluedesc
  1203. wscript.echo " EmailToStatic " &EmailToStatic
  1204. '****
  1205. call ReadCAPS_Control("EmailToStatic2",capsvaluedesc)
  1206. wscript.echo "capsvaluedesc " &capsvaluedesc
  1207. EmailToStatic2 = capsvaluedesc
  1208. wscript.echo " EmailToStatic2 " &EmailToStatic2
  1209. '****
  1210. call ReadCAPS_Control("EmailFromStatic",capsvaluedesc)
  1211. wscript.echo "capsvaluedesc " &capsvaluedesc
  1212. EmailFromStatic = capsvaluedesc
  1213. wscript.echo " EmailFromStatic " &EmailFromStatic
  1214. '****
  1215. call ReadCAPS_Control("EmailBase",capsvaluedesc)
  1216. wscript.echo "capsvaluedesc " &capsvaluedesc
  1217. EmailBase = capsvaluedesc
  1218. wscript.echo " EmailBase " &EmailBase
  1219. '****
  1220. call ReadCAPS_Control("EmailLongBase",capsvaluedesc)
  1221. wscript.echo "capsvaluedesc " &capsvaluedesc
  1222. EmailLongBase = capsvaluedesc
  1223. wscript.echo " EmailLongBase " &EmailLongBase
  1224. '****
  1225. call ReadCAPS_Control("EmailServer",capsvaluedesc)
  1226. wscript.echo "capsvaluedesc " &capsvaluedesc
  1227. EmailServer = capsvaluedesc
  1228. wscript.echo " EmailServer " &EmailServer
  1229. '****
  1230. call ReadCAPS_Control("FQDN",capsvaluedesc)
  1231. wscript.echo "capsvaluedesc " &capsvaluedesc
  1232. FQDN = capsvaluedesc
  1233. call ReadCAPS_Control("ROOTDN",capsvaluedesc)
  1234. wscript.echo "capsvaluedesc " &capsvaluedesc
  1235. Root_DN = capsvaluedesc
  1236. Call ReadCAPS_Control("FQDN_Base",capsvaluedesc)
  1237. wscript.echo "capsvaluedesc " &capsvaluedesc
  1238. FQDN_Base = capsvaluedesc
  1239. wscript.echo " fqdn_base " &FQDN_Base
  1240.  
  1241. '* Ticket # 274098 cbcaps0016, mej 02/15/2012 end      
  1242.  
  1243. '* Variable Initialization
  1244.  
  1245. vbQuote = Chr(34)
  1246. strdept = ""
  1247. cc = ""
  1248. ln = ""
  1249.  
  1250. if (Wscript.Arguments.Count > 0) then
  1251.   Call CreateNewHiresFile(Wscript.Arguments.Item(0))
  1252. end if
  1253.  
  1254. '* Create Files System Object for writing output to file
  1255. Set fso = CreateObject("Scripting.FileSystemObject")
  1256. Set MyFile = FSO.OpenTextFile("c:\eunewhires.txt", 1)
  1257. Wscript.Echo "UserAccount script started:"
  1258. MyFile.ReadLine
  1259. Do Until MyFile.AtEndOfStream
  1260.    strNextLine = MyFile.ReadLine
  1261.    strNextLine = trim(strNextLine)
  1262.    if (strNextLine <> "")Then
  1263.         arrServiceList = Split(strNextLine , chr(9))
  1264.         cc=arrServiceList(0)
  1265.         ln=arrServiceList(1)
  1266.         fn=arrServiceList(2)
  1267.         mi=arrServiceList(3)
  1268.         eid=arrServiceList(4)
  1269.         etype=arrServiceList(5)
  1270.         aliasB=arrServiceList(6)
  1271.         emailext=arrServiceList(7)
  1272.         '* Incident #91305 cbcaps0048, mej 10/31/2014 allow email overide begin
  1273.         emailoveride=arrServiceList(8)
  1274.         '* Incident #91305 cbcaps0048, mej 10/31/2014 allow email overide end
  1275.         status1 = ""
  1276.         status2 = ""
  1277.         alias1 = ""
  1278.         alias2 = ""
  1279.         '  if ((len(ln)+len(fn)+1) <= 20) then
  1280.             Wscript.Echo "     Processing New User:" & strNextLine
  1281. '* Ticket # 274098 cbcaps0016, mej 02/15/2012 begin
  1282. '                       Call CheckAlias(ln,fn,mi,eid,etype,jobtype1,aliasb,status1)
  1283.             Call CheckAlias(ln,fn,mi,eid,etype,jobtype1,group_base,FQDN,Root_DN,EmailBase,aliasb,status1)
  1284.             StatusNB = Status1
  1285.             StatusB  = Status1
  1286.             if (StatusNB <> "Account Already Exists" ) then
  1287. '                               Call CreateNewUser(aliasB, ln, fn, mi, eid, etype, cc, objUser, OU, strpw, Server,mbserver, bserver, bstore, emailto)
  1288.                 Call CreateNewUser(aliasB, ln, fn, mi, eid, etype, cc, Root_DN,emaillongbase,objUser, OU, strpw, Server,mbserver, bserver, bstore, emailto)
  1289. '* Ticket # 274098 cbcaps0016, mej 02/15/2012 end
  1290. '* Ticket # 274098 cbcaps0016, mej 02/15/2012 begin
  1291. '*  Ticket: 243168, CBCAPS0004 -- begin
  1292. '* old Call to create email with exchange 2003
  1293. '*              Call CreateMailBox(aliasB,emailext ,cc, etype, objUser, mbserver, bstore)
  1294.                 gUsername = aliasB
  1295. '               gEmail = guserName & "@CIBER.CBR.INC"
  1296.                 gEmail = guserName & emaillongbase
  1297. '* Ticket # 274098 cbcaps0016, mej 02/15/2012 end
  1298. ' # Incident # 5937 cbcaps0030, mej 11/05/2013 use exchange 2010 calls add new variables begin
  1299. call ReadCAPS_Control("MaxCount",capsvaluedesc)
  1300. 'wscript.echo "capsvaluedesc " &capsvaluedesc
  1301. MaxCount = capsvaluedesc
  1302.  
  1303. call ReadCAPS_Control("MaxTries",capsvaluedesc)
  1304. 'wscript.echo "capsvaluedesc " &capsvaluedesc
  1305. MaxTries = capsvaluedesc
  1306.  
  1307. 'call ReadCAPS_Control("MailType",capsvaluedesc)
  1308. 'wscript.echo "capsvaluedesc " &capsvaluedesc
  1309. 'MailType = capsvaluedesc
  1310.  
  1311. call ReadCAPS_Control("MailType1",capsvaluedesc)
  1312. wscript.echo "MailType1 " &capsvaluedesc
  1313. MailType = capsvaluedesc
  1314.  
  1315. 'call ReadCAPS_Control("MailType2",capsvaluedesc)
  1316. 'wscript.echo "capsvaluedesc " &capsvaluedesc
  1317. 'MailType = capsvaluedesc
  1318.  
  1319. 'call ReadCAPS_Control("Region",capsvaluedesc)
  1320. 'wscript.echo "capsvaluedesc " &capsvaluedesc
  1321. 'Region = capsvaluedesc
  1322.  
  1323. call ReadCAPS_Control("Region1",capsvaluedesc)
  1324. wscript.echo "Region " &capsvaluedesc
  1325. Region = capsvaluedesc
  1326.  
  1327. call ReadCAPS_Control("LookupErr",capsvaluedesc)
  1328. wscript.echo "LookupErr " &capsvaluedesc
  1329. LookupErr = capsvaluedesc
  1330.  
  1331. '* Incident # 5937 cbcaps0030, mej 11/05/2013 use exchange 2010 calls add new variables end
  1332.  
  1333. call ReadCAPS_Control("mailerrorlog",capsvaluedesc)
  1334. wscript.echo "mailerrorlog " &capsvaluedesc
  1335. maillog = capsvaluedesc
  1336.  
  1337. Set objShell = CreateObject("Wscript.Shell")
  1338.  
  1339. 'NewEmailScriptName = "c:\adscripts\Enable_ExternalMailUser.ps1"
  1340. '* Incident # 5937 cbcaps0030, mej 11/05/2013 use exchange 2010 calls begin
  1341. 'call ReadCAPS_Control("mailuserscript",capsvaluedesc)
  1342. call ReadCAPS_Control("mailboxscript",capsvaluedesc)
  1343. '* Incident # 5937 cbcaps0030, mej 11/05/2013 use exchange 2010 calls end
  1344. 'wscript.echo "capsvaluedesc " &capsvaluedesc
  1345. NewEmailScriptName = capsvaluedesc
  1346.  
  1347. gEmail1 = " -principalname " &gemail
  1348. mbserver1 = " -mbserver " &mbserver
  1349. storegrp1 = "  -mbdb " &storegrp1
  1350. bstore1 = " -bstore " &bstore1
  1351. '* Ticket # 274098 cbcaps0016, mej 02/15/2012 begin
  1352. '* Incident #91305 cbcaps0048, mej 10/31/2014 allow email overide begin
  1353. if instr(emailext,"@") > 0 and mailtype = "Mailbox" then
  1354.     emailext =  left(emailext,(instr(emailext,"@")-1))
  1355. End if
  1356. '* Incident #91305 cbcaps0048, mej 10/31/2014 allow email overide end
  1357. emailext1 = " -emaddress " &emailext
  1358. maillog1 = " -emaillog " &maillog
  1359. FQDN_Base1 = " -DomainController "&FQDN_Base
  1360. '* Ticket # 274098 cbcaps0016, mej 02/15/2012 end
  1361.  
  1362. '* Incident # 5937 cbcaps0030, mej 11/05/2013 use exchange 2010 calls set new variables begin
  1363. Regions = " -Region "&Region
  1364. MaxCount1 = " -MaxCount "&MaxCount
  1365. MaxTries1 = " -MaxTries "&MaxTries
  1366. MailType1 = " -MailType "&MailType
  1367. LookupErr1 = " -LookupErr "&LookupErr
  1368. '* Incident #91305 cbcaps0048, mej 10/31/2014 allow email overide begin
  1369. If EmailOveride = "Y" and mailtype = "Mailbox" then
  1370.         alias1 = " -alias "&emailext
  1371.     else
  1372.                 alias1 = " -alias "&aliasB
  1373. End if
  1374. If mailtype = "MailUser" then
  1375.         alias1 = " -alias "&aliasB
  1376. End if
  1377. '* Incident #91305 cbcaps0048, mej 10/31/2014 allow email overide end
  1378. ' prior call
  1379. '       alias1 = " -alias "&aliasB
  1380. '* Incident # 5937 cbcaps0030, mej 11/05/2013 use exchange 2010 calls set new variables end
  1381.  
  1382. 'MBServer=Tdc-exmbt2
  1383. 'Store=100mb
  1384. 'StorageGRP=tdc-100mb
  1385. 'Wscript.Echo "gma:" & gEmail1
  1386. 'Wscript.Echo "mbserver1:" & mbserver1
  1387. 'Wscript.Echo "storegrp1:" & storegrp1
  1388. 'Wscript.Echo "bstore1:" & bstore1
  1389. 'Wscript.Echo "mbserver1:" & mbserver1
  1390.  
  1391. 'Posh= "C:\windows\system32\WindowsPowerShell\v1.0\PowerShell.exe "
  1392. call ReadCAPS_Control("poshexe",capsvaluedesc)
  1393. 'wscript.echo "capsvaluedesc " &capsvaluedesc
  1394. Posh =  capsvaluedesc
  1395. '* Ticket # 274098 cbcaps0016, mej 02/15/2012 begin
  1396. 'PoshLaunch=Posh & " "&NewEmailScriptName  &gEmail1 &" " &emailext &" " &maillog &" "
  1397. 'PoshLaunch=Posh & " "&NewEmailScriptName  &gEmail1 &" " &emailext1 &" " &maillog1 &" " &FQDN_Base1 &" "
  1398. '* Incident # 5937 cbcaps0030, mej 11/05/2013 use exchange 2010 calls add new variables begin
  1399. 'PoshLaunch=Posh & " "&NewEmailScriptName  &gEmail1 &mbserver1 &storegrp1 &bstore1 &FQDN_Base1 &" "
  1400. PoshLaunch=Posh & " "&NewEmailScriptName  &gEmail1 &emailext1 &emaillog1 &FQDN_Base1 &Regions &MaxCount1 &MaxTries1 &MailType1 &LookupErr1  &alias1 &" "
  1401. '* Incident # 5937 cbcaps0030, mej 11/05/2013 use exchange 2010 calls add new variables end
  1402.  
  1403. Wscript.Echo "launch file:" & PoshLaunch
  1404. '* Ticket # 274098 cbcaps0016, mej 02/15/2012 end
  1405. return=objShell.Run (PoshLaunch, 1, true)
  1406. 'objShell.Run PoshLaunch
  1407. '*
  1408. '*  Ticket: 243168, CBCAPS0004 -- end
  1409.  
  1410. '* Ticket # 274098 cbcaps0016, mej 02/15/2012 begin
  1411. '                               Call EmailAdmin(aliasB, emailext,ln,fn,mi, eid, etype, cc,strpw, mbserver, emailto)
  1412. '               Call EmailAdmin(aliasB, emailext,ln,fn,mi, eid, etype, cc,strpw, mbserver, emailto,emailserver)
  1413. '* Ticket # 274098 cbcaps0016, mej 02/15/2012 end
  1414.                     Call EmailAdmin(emailext, aliasB,ln,fn,mi, eid, etype, cc,strpw, bserver, emailto,FQDN,Root_DN,emailfromstatic,emailtostatic,emailserver,emailbase)
  1415.             end if
  1416.         ' else
  1417.         '  StatusNB = "Name too Long"
  1418.             ' StatusB  = "Name too Long"
  1419.         'end if
  1420.         Call WriteLog(aliasB, aliasB,ln,fn,mi, eid, etype, cc,strpw, OU,StatusB, StatusNB)
  1421.     End If
  1422.     StatusNB = ""
  1423.     StatusB = ""
  1424. Loop
  1425. Wscript.Echo "UserAccount script ended."
  1426. MyFile.Close
  1427. end Sub
Add Comment
Please, Sign In to add comment