?
Solved

Single batch logon script for multiple users

Posted on 2006-06-16
9
Medium Priority
?
519 Views
Last Modified: 2008-01-09
Hi I'm currenly using kixtart for my logon. Its clean & easy. But for VPN users, the script window takes a long time to shut down, for some it doens't & when they try to force it to close it restarts the PC.

CLS
Select
Case @UserId = "jon"
   USE M: "\\server\ADMIN"
   AddPrinterConnection("\\server\printer1")
   SetDefaultPrinter("\\server\printer1")

Case @UserId = "sam""
   USE L: "\\server\DELIVERY"
   AddPrinterConnection("\\server\printer2")
   SetDefaultPrinter("\\server\printer2")

Case @UserId = "tim"
   USE S: "\\server\SALES"
   AddPrinterConnection("\\server\printer2")
   SetDefaultPrinter("\\server\printer2")
EndSelect

Is it possible to have this re-written for .bat? Can someone show me?


0
Comment
Question by:titanax
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 96

Accepted Solution

by:
Lee W, MVP earned 672 total points
ID: 16925715
CLS is pointless - I never bother.

What I used to do for VPN clients is check their IP info and if they were connected via VPN, then I had the logon script skip mapping things.  That may or may not work for you. Anyway, here's the batch file.

IF "%username%" = "jon" (
    Net Use M: \\server\adminc
    con2prt /cd \\server\printer1
)
IF "%username%" = "sam" (
    Net Use L: \\server\delivery
    con2prt /cd \\server\printer2
)
IF "%username%" = "jon" (
    Net Use S: \\server\sales
    con2prt /cd \\server\printer2
)
0
 
LVL 77

Expert Comment

by:Rob Williams
ID: 16926555
Rather than using a series of IF/Case statements for all users, is it possible to create individual scripts for each user and add to their profile. I know from a management point of view this adds overhead, but for a VPN user it would eliminate a lot of back and forth "talking" over a slow link.
0
 
LVL 85

Expert Comment

by:oBdA
ID: 16926559
kix32 is usually faster than batch, so I doubt you'd be faster using batch; this is more likely to be a network communication problem.
Anyway, I doubt that closing the kix logon script *restarts* the PC; it's more likely that the user is only logged off. kix installs its own event handler when run, and it will log off the user if the script is canceled as a precautionary measure.
You can allow terminating the logon script with a "break on" statement.
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 10

Expert Comment

by:victornegri
ID: 16927047
You can also enable the policy to process logon scripts asynchronously so the user gets their desktop while the script is running. Then they can do work while the script runs and it doesn't matter how long it runs for.

I agree with leew and create a separate Kix32 script that first checks their subnet to see if they're logging on via VPN. You can assign the result to a VPN variable and check it prior to the drive mapping portions of your login script.
0
 

Author Comment

by:titanax
ID: 16929729
leew, is "con2prt" a dos command??

"You can allow terminating the logon script with a "break on" statement." - I'n not a kix guru - how'd i write this?

0
 
LVL 85

Assisted Solution

by:oBdA
oBdA earned 664 total points
ID: 16929757
CLS
break on
Select
Case @UserId = "jon"
...
0
 
LVL 77

Assisted Solution

by:Rob Williams
Rob Williams earned 664 total points
ID: 16929847
con2ptr is an old and still widely used tool from the NT resource kit for adding/managing printers from the command line, or in a batch file. You can download the resource kit or from:
http://www3.ns.sympatico.ca/malagash/Downloads/Printers/con2prt.exe
Instructions:
http://support.microsoft.com/?kbid=181663
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

by Batuhan Cetin In this article I will be guiding through the process of removing a failed DC metadata from Active Directory (hereafter, AD) using the ntdsutil tool in a Windows Server 2003 environment. These steps are not necessary in a Win…
Numerous times I have been asked this questions that what is it that makes my machine log on so slow, there have been cases where computers took 23 minute exactly after taking password and getting to the desktop. Interesting thing was the fact th…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question