wiggum123 Posted March 16, 2011 Posted March 16, 2011 (edited) I am trying to create a script that creates users using csvde, then using dsquery and dsmod to enable their accounts, set the password and set their homedrive with homedirectory. The problem I am hitting is with the homedir, it needs to end with the current user I am editing, if I use the %Username% variable it uses the currently connected user and sets them all to that.... Is there another way of using dsget or dsquery to pipe the username its editing? This is what I have so far. ::Location of the csv file with the user info SET filename="\\path\to\file\file.csv" ::Location to create users, you should have this info in the DN section of the csv file without the username SET location="OU=Import,OU=Students,OU=Accounts,DC=domain,DC=local" ::Home directory SET homedir=\\path\to\homedir\ ::User password SET password="password" csvde -f %filename% -i -k PAUSE Dsquery user %location% | Dsmod user -pwd %password% -hmdrv h: -hmdir %homedir%%username% -disabled no PAUSE Edited March 16, 2011 by wiggum123
wiggum123 Posted March 16, 2011 Author Posted March 16, 2011 Never mind, fixed it. If its useful, here is the fix; Had to use $username$ and not %username% ::Location of the csv file with the user info SET filename="\\path\to\file\file.csv" ::Location to create users, you should have this info in the DN section of the csv file without the username SET location="OU=Import,OU=Students,OU=Accounts,DC=domain,DC=local" ::Home directory SET homedir=\\path\to\homedir\ ::User password SET password="password" csvde -f %filename% -i -k PAUSE Dsquery user %location% | Dsmod user -pwd %password% -hmdrv h: -hmdir %homedir%$username$ -disabled no PAUSE
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now