Solved

Single batch logon script for multiple users

Posted on 2006-06-16
9
511 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 83

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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 83

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Organizations create, modify, and maintain huge amounts of data to help their businesses earn money and generally function.  Typically every network user within an organization has a bit of disk space to store in process items and personal files.   …
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
This video discusses moving either the default database or any database to a new volume.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now