OK folks, below is the first draft of a mass user creation vbs script I'm trying to convert into Kix. Bob Kelly's book, "Scripting with Kixtart" has a short but informative section on converting VBS to Kix and that helped. But please be gentle, I'm still a newbie to Kix (and vbs for that matter!).

So here are the things I think I still need to work on. Please feel free to add to the list.

1. There's a vbs section with what looks like variables all preceded by CONST. I have to figure out what to do there.

2. I have to figure out what to do with Create$Object.

3. I think I have to change 'err.number = 0' to 'error = 0' (without the quotes) and 'if (err.number <> 0' to something like 'if error <> 0'.

4. I think there's a few exist statements I have to convert from vbs to kix.

5.I need to sort through the whole log file section.

6. There's a fs.createfolder command that I think needs to be converted from vbs to kix.

7. Is objUser.put a valid kix command?

8. I have to figure out what to do with $objFile.write/close/etc.

9. There is a difference between some of the values that are in the original script and what I want to put in. (I.E add the profile path and change the home folders names from lastname.firstinitial to firstname.lastname).

There's probably lots of other mistakes (and sorry for the length of this post). But I'd really appreciate any help you have the time to give me.

Oh, and I've decided not to include the extraction of data from the foxpro database yet. One thing at a time!

Code:
 
; Used to be a VBscript (now is a KIX script) to create multiple user accounts from a text file supplied by user
; text file layout needs to be the following
; Student ID, Last Name, First Name, Grade, Phone Number
;
; 1.25 2006/05/23 Jeremy Schubert


; This script uses the First name"."last name for account names
; This script uses the phone number of the person as the initial Password
; home dirs are created as \ USERS \ students \ gradexx \ firstname.lastname$
; ie: I:\users\students\grade10\jane.doe$
; (account = Jane Doe)
;
;
;
;This script will check For the following:
; that the plant code is three characters long
; check that the OU structure exists to create the user in And that the user running the script can connect to it.
; checks to make sure that the groups the user is to be added to exist
; checks that the directory And file that is to be used to create users exists
; checks to make sure that the log directory and log file exists if not it will create them
; checks to make sure that the home directory path exists
; Checks that the user name does not exceed 20 characters

; checks For the existanace of the user anywhere in the Student Domain
; checks for the existanace of the home drive before creating it
; Checks to see If the Password is 7 characters Or longer


; This script will add the user to the following groups by $default
; GGXXX-INTERNET
; GGXXX-STUDENTS
; GGXXX-GRADEXX
; GG-SECTION06

;SetOption ('Explicit','On')
;If @ERROR <> 0 Then Next
On Error Resume Next

; Declare variables
Dim $objPLANT
Dim $defPLANT
Dim $defPLLG
Dim $objBAD
Dim $objSERV
Dim $objSERV1
Dim $objHPATH
Dim $objOU
Dim $objOU1
Dim $objGROUP1
Dim $objGROUP2
Dim $objGROUP3
Dim $objGROUP4
Dim $objNetwork
Dim $defTXTPTH
Dim $objTXTPTH
Dim $defTEXT
Dim $objTEXT
Dim $objtxtfile
Dim $objTFILE
Dim strNextLine
Dim $objTXTin
Dim $objSTUID
Dim $objSNAME
Dim $objFNAME
Dim $objLNAME
Dim $objSUSER
Dim $defSUSER
Dim $objGrade
Dim $objNEWA
Dim $defhois
Dim $defSTUID
Dim $defGrade
Dim $objUSERP

Dim $objFSO
Dim $objFile
Dim $objlogfodler
Dim $objLOGFILE
Dim $objHOMED
Dim $defHOMED
Dim $objShare
Dim ShareService$obj
Dim oDomain
Dim oUSER
Dim $objPASS
Dim $defPASS
Dim $defPWLG
Dim $objUUPN
Dim $defLCHA
Dim FS
Dim $objUSER
Dim $objDNAME
Dim NewShare
Dim $objShell

Dim $objProfilePath

;These were Dimmed in the original VBS file

;DIM $objGROUP5?
;Dim $objFOLDER
;DIM $objTEXTFILE
;Dim Txtin
;DIM strNEXTLine
;Dim i
;DIM Txtfile
;Dim LOGFolder
;DIM LOGFILE

;I'm not sure how to convert the Const to kix

Const ADS_UF_NORMAL_ACCOUNT = 512
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8

Const FILE_SHARE = 0
Const MAXIMUM_CONNECTIONS = 5

$objFSO = Create$object ("Scripting.FileSystem$object")
FS = Create$object("Scripting.FileSystem$object")
$objNetwork = WScript.Create$object("Wscript.Network")

; Have user enter plant code. Used in selectiong Server name and OU structure
Do Until $defPLANT = vbYES
$objPLANT = Gets ("Please Enter your Plant Code (Must be 3 digits). Enter 999 to exit.", "USER CREATION - PLANT CODE")
$defPLANT = MessageBox ("The plant code that you entered is: " + $objPLANT + @crlf + "Is this Correct?", 4)
Loop

; check to make sure that the plant code is three characters long
$defPLLG = Len($objPLANT)
If $defPLLG <> 3
MessageBox ("The plant code that you entered is not three characters long. Existing Program.")
Goto end
EndIf

; variables as determined by plant code that was entered
Select Case $objPLANT
Case "047"
$objSERV = "\\S047-S0371-01\"
$objSERV1 = "S047-S0371-01"
Err.Number = 0
$objOU1 = ",OU=047USTUDENTS,OU=047USCHOOL,OU=SECTIONU06,OU=User Accounts,DC=student,DC=xxxx,DC=xx,DC=xx"
$objOU = Get$object("LDAP://OU=047USTUDENTS,OU=047USCHOOL,OU=SECTIONU06,OU=User Accounts,DC=student,DC=xxxx,DC=xx,DC=xx")
If (Err.Number <> 0)
MessageBox "Unable to connect to the OU structure for this school. Existing Program."
Goto end
EndIf
Err.Number = 0
$objGROUP1 = Get$object("LDAP://CN=GG047-INTERNET,OU=047UGROUPS,OU=047USCHOOL,OU=SECTIONU06,OU=User Accounts,DC=student,DC=xxxx,DC=xx,DC=xx")
If (Err.Number <> 0)
MessageBox "The Group GG047-INTERNET no longer exists. Existing Program."
Goto end
EndIf
Err.Number = 0
$objGROUP2 = Get$object("LDAP://CN=GG047-STUDENTS,OU=047UGROUPS,OU=047USCHOOL,OU=SECTIONU06,OU=User Accounts,DC=student,DC=xxxx,DC=xx,DC=xx")
If (Err.Number <> 0)
MessageBox "The Group GG047-STUDENTS no longer exists. Existing Program."
Goto end
EndIf
$objHPATH = "users$\students\"
If Not FS.FolderExists($objSERV + $objHPATH)
MessageBox "The home directory path of " + $objSERV + $objHPATH + " no longer exists. Existing Program."
Goto end
EndIf
;$objSNAME = "logon047.bat"
$objlogfodler = "c:\log"
$objLOGFILE = "c:\log\Muser.txt"
$objUSERP = "I:\users\students\"


Case "071"
$objSERV = "\\S071-S0371-01\"
$objSERV1 = "S071-S0371-01"
Err.Number = 0
$objOU1 = ",OU=071USTUDENTS,OU=071USCHOOL,OU=SECTIONU02,OU=User Accounts,DC=student,DC=xxxx,DC=xx,DC=xx"
$objOU = Get$object("LDAP://OU=071USTUDENTS,OU=071USCHOOL,OU=SECTIONU02,OU=User Accounts,DC=student,DC=xxxx,DC=xx,DC=xx")
If (Err.Number <> 0)
MessageBox "Unable to connect to the OU structure for this school. Existing Program."
Goto end
EndIf
Err.Number = 0
$objGROUP1 = Get$object("LDAP://CN=GG071-INTERNET,OU=071UGROUPS,OU=071USCHOOL,OU=SECTIONU02,OU=User Accounts,DC=student,DC=xxxx,DC=xx,DC=xx")
If (Err.Number <> 0)
MessageBox "The Group GG071-INTERNET no longer exists. Existing Program."
Goto end
EndIf
Err.Number = 0
$objGROUP2 = Get$object("LDAP://CN=GG071-STUDENTS,OU=071UGROUPS,OU=071USCHOOL,OU=SECTIONU02,OU=User Accounts,DC=student,DC=xxx,DC=xx,DC=xx")
If (Err.Number <> 0)
MessageBox "The Group GG071-STUDENTS no longer exists. Existing Program."
Goto end
EndIf
$objHPATH = "users$\students\"
If Not FS.FolderExists($objSERV + $objHPATH)
MessageBox "The home directory path of " + $objSERV + $objHPATH + " no longer exists. Existing Program."
Goto end
EndIf
$objSNAME = "logon071.bat"
$objlogfodler = "c:\log"
$objLOGFILE = "c:\log\Muser.txt"
$objUSERP = "I:\users\students\"

Case "999"
MessageBox "Script terminated by user. Existing Program."
Goto end

Case Else
MessageBox "The Plant Code that you entered is not recognized by this script. Existing Program."
Goto end

End Select

; Have user enter path of where the text file is located
Do Until $defTXTPTH = vbYES
$objTXTPTH = Gets ("Please enter the path of the text file to use " + @crlf + "(e.g. c:\users\students).", "MASS ACCOUNNT CREATION - PATH of TEXT file")
$defTXTPTH = MessageBox ("The path of the text file is : " + $objTXTPTH + @crlf + "Is this Correct?", 4)
Loop

Do Until $defTEXT = vbYES
$objTEXT = Gets ("Please Enter the text file to use (must end in .txt)" + @crlf + "(e.g. users.txt)", "MASS ACCOUNT CREATION - PLANT CODE")
$defTEXT = MessageBox ("The text file name that you entered is : " + $objTEXT + @crlf + "Is this Correct?", 4)
Loop

$objtxtfile = $objTXTPTH + "\" + $objTEXT


; Check for the existence of the text file that the user entered.
If $objFso.FileExists($objtxtfile)
MessageBox "Confirmed existance of text file. Press OK to continue."
Else
MessageBox "The text file you entered does not exist. Existing Program."
Goto end
EndIf

; create log folder, create log file, If it exists append to the file if not create one.
If $objFSO.FolderExists($objlogfodler)
If $objFso.FileExists($objLOGFILE)
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteBLANKlines (2)
$objFILE.WriteLine "Creating Accounts " + Now
$objFile.Close
Else
$objFILE = $objFSO.CreateTextFile ($objLOGFILE)
$objFile.Close
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, Forwriting)
$objFILE.WriteLine "Creating Accounts " + Now
$objFile.Close
EndIf
Else
$objFolder = $objFSO.CreateFolder ($objlogfodler)
$objFILE = $objFSO.CreateTextFile ($objLOGFILE)
$objFile.Close
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, Forwriting)
$objFILE.WriteLine "Creating Accounts " + Now
$objFile.Close
EndIf

; write plant code to log file
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteBLANKlines (2)
$objFILE.WriteLine "Accounts will be created for plant code " + $objPLANT
$objFILE.WriteBLANKlines (2)
$objFile.Close

$objTFILE = $objFSO.OpenTextFile ($objtxtfile, ForReading)

; read each line of the text file one by one and loop until end of file
Do Until $objTFILE.AtEndOfStream
strNextLine = $objTFILE.ReadLine
; split line into fields and place into 1 dimensional array, assuming txt file
; and comma separated values
$objTXTin = Split(strNextLine , ",")
; variables to meaningful names
$objSTUID = $objTXTin(0)
$objLNAME = $objTXTin(1)
$objFNAME = $objTXTin(2)
$objGrade = $objTXTin(3)
$objPASS = $objTXTin(4)
$objSUSER = $objFNAME + "." + $objLNAME
$objHOMED = $objLNAME + Left ($objFNAME,1)

; enter account information into log file
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteLine "USER NAME: " + $objSUSER
$objFILE.WriteLine "Home Directory: " + $objHOMED
$objFile.Close

; check for length of username and home directory
$defSUSER=40
Do Until $defSUSER <= 20
$defSUSER = Len($objSUSER)
If $defSUSER > 20
$objNEWA = 1
MessageBox ("The length of the User name (" + $objSUSER + ") is to long." + @crlf + "Please enter a shorter username.")
$objFNAME = Gets ("Please Enter a new first name for the account (" + $objSUSER + "):", "USER CREATION - FIRST NAME")
If $objFNAME = ""
MessageBox "You clicked cancel or you left the entry empty. Skipping the creation of this account"
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteLine "SKipping account creation. "
$objFile.Close
$objNEWA = 0
Exit Do
EndIf
$objLNAME = Gets ("Please Enter a new last name for the account (" + $objSUSER + "):", "USER CREATION - LAST NAME")
If $objLNAME = ""
MessageBox "You clicked cancel or you left the entry empty. Skipping the creation of this account"
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteLine "SKipping account creation. "
$objFile.Close
$objNEWA = 0
Exit Do
EndIf
EndIf
$objSUSER = $objFNAME + "." + $objLNAME
$defSUSER = Len($objSUSER)
Loop

; write new user name to the log file
If $objNEWA = 1
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteLine "New account name is :" + $objSUSER
$objFile.Close
EndIf

; Check for existance of user
oDomain = Get$object("WinNT://xxxxSTU")
oDomain.Filter = Array("user")
For Each oUser in oDomain
If Lcase(oUser.name) = Lcase($objSUser)
? $objSUser + " already has an account. Skipping the creation of this user"
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteLine "Account already created. SKipping this account. "
$objFile.Close
Exit Do
EndIf
Next

; create home drive name from last name and first name
$objHOMED = Left ($objLNAME) + Left ($objFNAME)
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteLine "The home directory name is :" + $objHOMED
$objFile.Close

; check to see if the home directory exists if not create it
$defhois = 0
Err.Number = 0
FS.CreateFolder($objSERV + $objHPATH + $objHOMED)
If (Err.Number <> 0)
$defhois = 1
MessageBox "The directory of :" + $objSERV + $objHPATH + $objHOMED + " already exists."
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteLine "The home directory of " + $objHOMED + " already exists."
$objFile.Close
Err.Number = 0
Else
$defhois = 0
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteLine "The home directory of " + $objHOMED + " was sucessfully created."
$objFile.Close
Err.Number = 0
EndIf

;if the home directory does exist have user enter a new one and check again if it exits
Do Until $defhois = 0
Err.Number = 0
$objHOMED = Gets ("Please Enter a new home directory name for the account (" + $objSUSER + "):", "USER CREATION - NEW HOME DIRCTORY NAME")
$defHOMED = Len($objHOMED)
; If $defHOMED > 12
; $defhois = 1
; MessageBox ("The length of the Home Directory name is: " + $defHOMED + ". This is to long. Try again please.")

Else
Err.Number = 0
FS.CreateFolder($objSERV + $objHPATH + $objHOMED)
If (Err.Number <> 0)
MessageBox "The directory of :" + $objHPATH + $objHOMED + " already exists."
$defhois = 1
Err.Number = 0
Else
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteLine "The home directory of " + $objHOMED + " was sucessfully created."
$objFile.Close
$defhois = 0
Err.Number = 0
EndIf
EndIf
Loop


; check to see if the Student ID is 6 digits long
$defSTUID = 7
Do Until $defSTUID = 6
$defSTUID = Len($objSTUID)
If $defSTUID <> 6
MessageBox ("The current student ID of: " + $objSTUID + " is invalid for account :" + $objSUSER + ".")
$objSTUID = Gets ("Please Enter a new Student ID (Range 000000 to 999999) for the account (" + $objSUSER + "):", "USER CREATION - STUDENT ID")
Else
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteLine "The Student ID for account " + $objSUser + " is " + $objSTUID
$objFile.Close
EndIf
Loop

; check to see if the Student Grade is 2 digits long
$defGrade = 7
Do Until $defGrade = 2
$defGrade = Len($objGrade)
If $defGrade <> 2
MessageBox ("The current student grade of: " + $objGrade + " is invalid for account :" + $objSUSER + ".")
$objGRADE = Gets ("Please Enter a new Student Grade (Range 01 to 12) for the account (" + $objSUSER + "):", "USER CREATION - STUDENT GRADE")
Else
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteLine "The Grade for account " + $objSUser + " is " + $objGRADE
$objFile.Close
EndIf
Loop

; check to see if the student phone number is 7 digits long
$defPASS = 8
Do Until $defPASS = 7
$defPASS = Len($objPASS)
If $defPASS <> 7
MessageBox ("The current student phone number of: " + $objPASS + " is invalid for account :" + $objSUSER + ".")
$objPASS = Gets ("Please Enter a new Studentnt Phone Number (Range 1111111 to 9999999) for the account (" + $objSUSER + "):", "USER CREATION - STUDENT PHONE NUMBER")
Else
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteLine "The Student Phone Number for account " + $objSUser + " is " + $objPASS
$objFile.Close
EndIf
Loop

; create user and attributes
$objUUPN = $objSUSER + "@xxxx.ab.ca"
$objDNAME = $objFNAME + " " + $objLNAME
$objUSER = $objOU.Create("User", "cn=" + $objSUSER)
$objUser.Put "SamAccountName", $objSUSER
$objUser.Put "UserPrincipalName", $objUUPN
$objUser.Put "GivenName", $objFNAME
$objUser.Put "sn", $objLNAME
$objUser.Put "DisplayName" , $objDNAME
$objUser.Put "Description", "Student User Account"
$objUser.Put "l", "Calgary"
$objUser.Put "st", "AB"
$objUser.Put "c", "CA"
$objUser.Put "co", "Canada"
$objUser.Put "HomeDirectory", $objSERV + $objHOMED + "$"
$objUser.Put "HomeDrive", "H:"
$objUser.Put "scriptpath", $objSNAME
; $objUser.Put "ProfilePath", $objProfilePath?

Err.Number = 0
$objUser.Info
If (Err.Number <> 0)
MessageBox "There Was problems in creating the user. Please check Active Directory User and Computers " + @crlf + "for the account and correct any problems there."
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteLine "There were errors in creating the account : " + $objSUSER + ". Please check AD Users and computers."
$objFile.Close
Else
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteLine "The Account : " + $objSUSER + " was successfully created."
$objFile.Close
EndIf
$objUser.Password($objPASS)
$objUser.AccountDisabled = 0
$objUser.Info
$objUser.Put "pwdLast", 0
Err.Number = 0
$objUser.Info
If (Err.Number <> 0)
MessageBox "There Was problems in creating the user. Please check Active Directory User and Computers " + @crlf + "for the account and correct any problems there."
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteLine "There were errors in creating the account : " + $objSUSER + ". Please check AD Users and computers."
$objFile.Close
Else
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteLine "The Account : " + $objSUSER + " was successfully activated and password was ."
$objFile.Close
EndIf

; sleep for 3 seconds to give the system time to create the account before adding it to groups
Sleep 20000

; add user to the $default groups
Err.Number = 0
$objGROUP1.Add("LDAP://cn=" + $objSUSER + $objOU1)
If (Err.Number <> 0)
MessageBox "There Was a problem in adding the user: " + $objSUSER + " to the Internet group for your school." + @crlf + "Please check Active Directory User and Computers for the account and correct any problems there."
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteLine "There was an error in adding the user : " + $objSUSER + " to the Internet group for school " + $objPLANT
$objFile.Close
Else
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteLine "The user: " + $objSUSER + " was successfully added to the Internet Group for school " + $objPLANT
$objFile.Close
EndIf

Err.Number = 0
$objGROUP2.Add("LDAP://cn=" + $objSUSER + $objOU1)
If (Err.Number <> 0)
MessageBox "There Was a problem in adding the user: " + $objSUSER + " to the General Student group for your school." + @crlf + "Please check Active Directory User and Computers for the account and correct any problems there."
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteLine "There was an error in adding the user : " + $objSUSER + " to the General Student group for school " + $objPLANT
$objFile.Close
Else
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteLine "The user: " + $objSUSER + " was successfully added to the General Student Group for school " + $objPLANT
$objFile.Close
EndIf
$objShell = Create$object("Wscript.Shell")

;add to other groups

;share home drive and make it hidden
Err.Number = 0
$objShare = $objHOMED + "$"
$objUDIR = $objUSERP + $objHOMED
$objWMIService = Get$object("winmgmts:"& "{impersonationLevel=impersonate}!\\" + $objSERV1 + "\root\cimv2")
$objNewShare = $objWMIService.Get("Win32_Share")
errReturn = $objNewShare.Create ($objUDIR, $objShare, FILE_SHARE, MAXIMUM_CONNECTIONS, "Shared by Remote Command.")
;$objshell.Run "rmtshare.exe " + $objserv + $objshare + " = "& $objUSERP + $objhomed + " /users:1"
;IF (Err.Number <> 0)
; MessageBox "There Was a problem in creating the share: " + $objShare + " for the user: " + $objSUSER + @crlf + "Please check the file server for your school to correct the problem"
; $objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
; $objFILE.Writeline "There Was a problem in creating the share: " + $objShare + " for the user: " + $objSUSER + ". Please check the file server for your school to correct the problem"
; $objFile.Close
;ELSE
; $objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
; $objFILE.Writeline "The share: " + $objShare + " was successfully created for the user: " + $objSUSER + "."
; $objFile.Close
;EndIf

; share permisssions
Err.Number = 0
; add local Administrators to the share with full control permissions
$objShell.Run "acl.exe -on " + $objSERV + $objShare + " -ot shr -actn ace -ace n:" + $objSERV1 + "\administrators:p:full -silent"
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteBLANKlines (1)
$objFile.Close
If (Err.Number <> 0)
MessageBox "There Was a problem in adding the administrators group to the permissions on the share: " + $objShare + @crlf + "Please check the file server for your school to correct the problem"
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteLine "There Was a problem in adding the administrators group to the permissions on the share: " + $objShare + "Please check the file server for your school to correct the problem"
$objFile.Close
Else
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteLine "The Administrators group was successfully added to the share: " + $objShare
$objFile.Close
EndIf
Sleep 3000

Err.Number = 0
; add the local group LGXXX-HOMEDIR to the share with full control permissions
$objShell.Run "acl.exe -on " + $objSERV + $objShare + " -ot shr -actn ace -ace n:" + $objSERV1 + "\LG" + $objPLANT + "-HOMEDIR:p:full -silent"
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteBLANKlines (1)
$objFile.Close
If (Err.Number <> 0)
MessageBox "There Was a problem in adding the LG" + $objPLANT + "-HOMEDIR group to the permissions on the share: " + $objShare + @crlf + "Please check the file server for your school to correct the problem"
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteLine "There Was a problem in adding the LG" + $objPLANT + "-HOMEDIR group to the permissions on the share: " + $objShare + "Please check the file server for your school to correct the problem"
$objFile.Close
Else
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteLine "The LG" + $objPLANT + "-HOMEDIR group was successfully added to the share: " + $objShare
$objFile.Close
EndIf
Sleep 3000

Err.Number = 0
; add the user account to the share with change permissions
$objShell.Run "acl.exe -on " + $objSERV + $objShare + " -ot shr -actn ace -ace n:xxxxstu\" + $objSUSER + ":p:change -silent"
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteBLANKlines (1)
$objFile.Close
If (Err.Number <> 0)
MessageBox "There Was a problem in adding " + $objSUSER + " to the permissions on the share: " + $objShare + @crlf + "Please check the file server for your school to correct the problem"
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteLine "There Was a problem in adding " + $objSUSER + " to the permissions on the share: " + $objShare + "Please check the file server for your school to correct the problem"
$objFile.Close
Else
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteLine "The user: " + $objSUSER + " was successfully added to the share: " + $objShare
$objFile.Close
EndIf
Sleep 3000

Err.Number = 0
;remove the everyone group from the share
$objShell.Run "acl.exe -on " + $objSERV + $objShare + " -ot shr -actn trustee -trst n1:Everyone:ta:remtrst:w:dacl -silent"
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteBLANKlines (1)
$objFile.Close
If (Err.Number <> 0)
MessageBox "There Was a problem in removing the Everyone group from the permissions on the share: " + $objShare + @crlf + "Please check the file server for your school to correct the problem"
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteLine "There Was a problem in removing the Everyone group from the permissions on the share: " + $objShare + "Please check the file server for your school to correct the problem"
$objFile.Close
Else
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteLine "The Everyone group was successfully removed from the share: " + $objShare
$objFile.Close
EndIf
Sleep 3000

; change directory permissions
$objShell.Run "acl.exe -on " + $objSERV + $objHPATH + $objHOMED + " -ot file -actn ace -ace n:xxxxstu\" + $objSUSER + ":p:change"
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteBLANKlines (1)
$objFile.Close
If (Err.Number <> 0)
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteLine "There Was a problem in adding the user account to the permissions on the home directory: " + $objHOMED + "Please check the file server for your school to correct the problem"
$objFile.Close
Else
$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteLine "The user account was successfully added to the home directory: " + $objHOMED
$objFile.Close
EndIf
Sleep 3000

$objFILE = $objFSO.OpenTextFile ($objLOGFILE, ForAppending)
$objFILE.WriteBLANKlines (2)
$objFile.Close
Sleep 5000



$objNEWA = 0
$defhois = 0
$objSTUID = ""
$objLNAME = ""
$objFNAME = ""
$objGrade = ""
$objPASS = ""
$objSUSER = ""
$objHOMED = ""

Loop

:End
;That's all there is folks!


_________________________
---
Bishop Grandin Technology Department
'Either we're on time, or we're late'