Jump to content

vb script not creating homedrive


Recommended Posts

Posted

well its that time of the year we test our mass account creation scripts ready for the new darlings

 

our vbs script works fine except it doesnt create the homedrive any more

 

if i manually copy an account, and create 1 , it creates the homedrive fine or if i change the location then change it back it creates it fine, but not through the vbs script.

i had this problem 2 years ago, cant for the life of me remeber how i fixed it

 

the script hasnt changed, server is now 2003 but if i point script homedrive back to old location, same thing

this is the code which should work as before

 objUser.Put "homeDirectory", "\\SERVERNAME\users$\"& userPrincipalName
objUser.Put "homeDrive", "u"
objUser.Put "mail", (userPrincipalName & "@EMAIL.ac.uk")
objUser.Put "givenName", givenName
objUser.Put "sn", sn
objUser.Put "userPrincipalName", userPrincipalName
objUser.Put "displayName", displayName

objUser.SetInfo 

but doesnt all of a sudden

Posted

From all my testing that vb will only asign that user to that Homedir. But won't acutally create it. When I used a similar script I had to go to each user's Home Dir setting, remove and replace the last letter and click ok.. that created the folder I wanted. However, if it *should* create the homedir -- I'd be interested in finding out why in some cases it doesn't.

 

Most scripts I've seen use a batch file to use 'cacls' that creates and sets the correct permissions on the folders.

 

There are severall posts all ready about creating Mass Users as well as some software in the download section if you haven't looked all ready.

 

Check out the attachment. It a script I found that reads excell, creates all the users and uses cacls to correct all the permissions on folders. Its in VB so you could customize it to your needs.

new_5.txt

Posted

thanks i found something similar to create homedrive and set permissions

but it is strange why it doesnt create any more when it did 2 weeks ago

code i have added is here

'This Section will Create The Users Home Drive on \\actual path to server 
Set ObjShell = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject") 
Set objFolder = objFSO.CreateFolder("\\actual path to server\" & strSam) 
wscript.echo(strsam & " homedrive was created.")

'Assigning File Permissions
If objFSO.FolderExists(strHomeFolder) Then
' Assign user permission to home folder.
intRunError = objShell.Run("%COMSPEC% /c Echo Y| cacls "_
& strHomeFolderadm & " /t /c /g Administrators:f "_
& strsam & ":C", 2, True)
If intRunError <> 0 Then
Wscript.Echo "Error assigning permissions for user " _
& strsam & " to home folder " & strHomeFolderadm
End If
End If

full link here in case anyone interested mass create accounts vbs

 

though i dont think it works either

could you post the stupermissions.bat that you use for permissions

cheers

Posted

Well yes you could. However, you still have to go back and highlight each new user you created in AD. Which I guess wouldn't be a pain if all the new users start in the same OU.

 

My AD has OU's for each grade based on YOG and the home folder structure matches it. With a script I can create all my new users no matter what year they're being placed in and automatically put them in the right OU with their matching Home Dir.

 

All depends on the amount of kids coming in I guess. If it were only like 10 kids or so I probably wouldn't bother with a script.

 

Misterbusy-2: IIRC, the script writes the batch file as it goes. One line for each new user. You just need a blank .bat file and make sure the values under 'set file values' is correct.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...