Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I append a dollar sign ($) to %USERNAME%

Status
Not open for further replies.

goecs

Technical User
Aug 8, 2001
13
US
I have hidden shares for each home directory. Now I want to select multible accounts in user manager and use the variable %USERNAME% in the Home directory path to globaly apply a home directory to all user accounts at once. But I need to append a dollar sign ($) to the end of the %USERNAME% variable so it will find the hidden share. I tried %USERNAME%$, but NT doesn't like that.

Anyone know how to do this?

Thanks, Chris.
 
I use a script in conjunction with a couple of Resource Kit utilities:
---------------------------------
net users %1 %2 /add /fullname:%3 /domain
net group %4 %1 /add /domain
md \\server1\users\%1
md \\server1\users\%1\exchange
wait 10
rmtshare \\server1\%1$=e:\users\%1
rcmd \\pdc net accounts /sync
wait 50
net users %1 /HOMEDIR:\\server1\%1$ /DOMAIN
rem net users %1 /SCRIPTPATH:LOGIN.BAT /DOMAIN
cacls \\server1\users\%1 /G Administrator:F %1:F
cacls \\server1\users\%1 /G EVERYONE:R
---------------------------------

The line that goes "rmtshare \\server1\%1$-e:\users\%1"
is the line that creates the share. Edit this script to match your environment and save it as a .cmd file, and you can supply command-line arguments like this: "createuser.cmd goecs password Christopher Accounting". This would create a user named 'goecs', set the password to 'password', name you Christopher and put you in the Accounting group. Then it would create a directory for you and share it out. It also sets your login script and sets the permissions on your personal folder to give Administrators full control and Everyone read permissions. You could edit this script to just make it easier to set home directories if you wanted to.

Hope this is helpful.

ShackDaddy
 
Thanks, ShackDaddy.
I have some scripts that create the homedirectory, and then the hidden share. It looks like the net user /homedir section of your script will work in conjunction with another script I have.

Chris.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top