Solved

Single batch logon script for multiple users

Posted on 2006-06-16
9
516 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 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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Scenerio: You have a server running Server 2003 and have applied a retail pack of Terminal Server Licenses.  You want to change servers or your server has crashed and you need to reapply the Terminal Server Licenses. When you enter the 16-digit lic…
Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

734 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