Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Single batch logon script for multiple users

Posted on 2006-06-16
9
Medium Priority
?
523 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
7 Comments
 
LVL 97

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 78

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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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 78

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

by Batuhan Cetin Within the dynamic life of an IT administrator, we hold many information in our minds like user names, passwords, IDs, phone numbers, incomes, service tags, bills and the order from our wives to buy milk when coming back to home.…
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

810 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