Solved

Single batch logon script for multiple users

Posted on 2006-06-16
9
515 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
9 Comments
 
LVL 95

Accepted Solution

by:
Lee W, MVP earned 168 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 84

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
Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

 
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 84

Assisted Solution

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

Assisted Solution

by:Rob Williams
Rob Williams earned 166 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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 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…
Many of us need to configure DHCP server(s) in their environment. We can do that simply via DHCP console on server or using MMC snap-in on each computer with Administrative Tools installed in a network. But what if we have to configure many DHCP ser…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

680 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