VBscript and active directory help!

Status
Not open for further replies.
C

Chibibar

Ok. I am trying to write some script that will make my life easier when creating a new user to our system.

right now I am using active directory users and computer to manually create users and add users to groups.

I am trying to figure out a way to enter a username, create a home directory for that user, assign the user to the directory (full access) and add user to a group LCETusers and employees (general folder for employees)

note: assuming I already create the user via active directory management, I just want to add to couple of groups by default. Maybe eventually have something nicer display as I learn more to make it even smoother.


This is what I have so far.
**************************************************
'VBScript for creating and adding users to Active Directory
'Version 1 created by David C
'------------------------------------------------------------------

'This script is design to amend to current Novell system.
'You can create a new user via Novell
'This script will create a user directory (i.e. home directory)

Dim strUser
'This variable is for setting location server
Dim strHome
Dim strHomeFolder

strHome = "\\lcetadm2\users\"
'Input box appear for admin to enter a user.
'Current version will not check for proper format

strCredentials = InputBox ("Please enter the user name and Press OK")

If strCredentials = "" Then
Wscript.Echo "Username cannot be blank"
Wscript.Quit
End If

strUser = StrCredentials

'This will check and create a home folder
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Wscript.Shell")

strHomeFolder = strHome & strUser
If strHomeFolder <> "" Then
If Not objFSO.FolderExists(strHomeFolder) Then
On Error Resume Next
objFSO.CreateFolder strHomeFolder
If Err.Number <> 0 Then
On Error GoTo 0
Wscript.Echo "Cannot create: " & strHomeFolder
End If
On Error GoTo 0
End If
End if
 
I did this exact thing for a previous employer, but it was in vb.net, not vbscript.

a quick glance at your logic for creating the folder appears sound..what kind of issues are you having? are you wanting help on making the AD groups and assigning the user permissions?
 
C

Chibibar

yup.. I have users but need to assign to groups (premade groups) and folder (to the folder above)
 
Status
Not open for further replies.
Top