Windows 2000 Logon script w/ automatic OE configuration

I have about 50 client machines connected to a samba 3 server using domain/roaming profiles and a logon script to set the time and map drives.

Im having a slight problem with the script when trying to setup users email accounts ( the email server is hosted on the samba3 server also ). When the user logs in for the first time i have a registry file that runs itself and sets a user up with his/her email address automatically in outlook express. The problem is the %USERNAME% varibale will not work and outlook express has               %USERNAME%@server.mydomain.com instead of the acutal user that is logged into the domain. Thus their email account will not work.

Is there an easier way of automatically setting up email accounts when the user logs into the domain ? If not whats the problem with the reg file below ?

thanks,
llain3000

   REGEDIT4

   [HKEY_CURRENT_USER\Software\Microsoft\Internet Account Manager\Accounts\info@server.mydomain.com]
   "DCEmail"=dword:00000002
   "POP3 Server"="server.mydomain.com"
   "POP3 Port"=dword:0000006e
   "SMTP Server"="server.mydomain.com"
   "SMTP Port"=dword:00000019
   "Connection Type"=dword:00000001
   "POP3 User Name"="%USERNAME%@server.mydomain.com"
   "SMTP Display Name"="%USERNAME%@server.mydomain.com"
   "SMTP Email Address"="%USERNAME%@server.mydomain.com"
   "SMTP Reply To Email Address"="%USERNAME%@server.mydomain.com"
   "SMTP Organization Name"=""
   "Account Name"="%USERNAME%@server.mydomain.com"
   "POP3 Timeout"=dword:0000003c
   "SMTP Timeout"=dword:0000003c
   "POP3 Secure Connection"=dword:00000000
   "Leave Mail On Server"=dword:00000000
   "POP3 Skip Account"=dword:00000000
   "POP3 Prompt for Password"=dword:00000000
   "SMTP User Name"="%USERNAME%@server.mydomain.com
   "SMTP Use Sicily"=dword:00000003
   "SMTP Secure Connection"=dword:00000000
   "SMTP Split Messages"=dword:00000000
   "SMTP Prompt for Password"=dword:00000000
llain3000Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Eagle6990Connect With a Mentor Commented:
By default registry files don't support variables.  With XP clients you could use the "Reg" command to add entries directly into the registry.  Since 2K doesn't support either of these, we have to do a little more.

An idea I had was to use a regular batch file and redirect the output to create your registry file on the fly and then import that one.  In my example it is located in the Windows directory but you can put it whereever you want and rename whatever you want it.

I would put this in your login script.

echo REGEDIT4 > %systemroot%\Email.reg

echo    [HKEY_CURRENT_USER\Software\Microsoft\Internet Account Manager\Accounts\info@server.mydomain.com] >> %systemroot%\Email.reg
echo    "DCEmail"=dword:00000002 >> %systemroot%\Email.reg
echo    "POP3 Server"="server.mydomain.com" >> %systemroot%\Email.reg
echo    "POP3 Port"=dword:0000006e >> %systemroot%\Email.reg
echo    "SMTP Server"="server.mydomain.com" >> %systemroot%\Email.reg
echo    "SMTP Port"=dword:00000019 >> %systemroot%\Email.reg
echo    "Connection Type"=dword:00000001 >> %systemroot%\Email.reg
echo    "POP3 User Name"="%USERNAME%@server.mydomain.com" >> %systemroot%\Email.reg
echo    "SMTP Display Name"="%USERNAME%@server.mydomain.com" >> %systemroot%\Email.reg
echo    "SMTP Email Address"="%USERNAME%@server.mydomain.com" >> %systemroot%\Email.reg
echo    "SMTP Reply To Email Address"="%USERNAME%@server.mydomain.com" >> %systemroot%\Email.reg
echo    "SMTP Organization Name"="" >> %systemroot%\Email.reg
echo    "Account Name"="%USERNAME%@server.mydomain.com" >> %systemroot%\Email.reg
echo    "POP3 Timeout"=dword:0000003c >> %systemroot%\Email.reg
echo    "SMTP Timeout"=dword:0000003c >> %systemroot%\Email.reg
echo    "POP3 Secure Connection"=dword:00000000 >> %systemroot%\Email.reg
echo    "Leave Mail On Server"=dword:00000000 >> %systemroot%\Email.reg
echo    "POP3 Skip Account"=dword:00000000 >> %systemroot%\Email.reg
echo    "POP3 Prompt for Password"=dword:00000000 >> %systemroot%\Email.reg
echo    "SMTP User Name"="%USERNAME%@server.mydomain.com >> %systemroot%\Email.reg
echo    "SMTP Use Sicily"=dword:00000003 >> %systemroot%\Email.reg
echo    "SMTP Secure Connection"=dword:00000000 >> %systemroot%\Email.reg
echo    "SMTP Split Messages"=dword:00000000 >> %systemroot%\Email.reg
echo    "SMTP Prompt for Password"=dword:00000000 >> %systemroot%\Email.reg

regedit /s %systemroot%\Email.reg
0
 
Eagle6990Commented:
Oh yeah, at the end of that you might want to put in a

del %systemroot%/Email.reg

just to cleanup.
0
 
llain3000Author Commented:
Worked perfectly. 50 extra points for having the solution sitting at my desk when i arrived in work :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.