Group Policy executes prior User login script execute
You can use the %username% and/or %computername% variables to control
the flow of the batch file or wsh script. I have a jscript batch
processor ("kshell") that I wrote for myself that interprets simple
script-like files (.kss files) without having to use the long-winded
Windows API calls. An example script that does what you want might look
like this:
if username == user1 skip 4 //skips the next 4 lines
if username == user2 skip 3
if username == user3 skip 2
netprt \\server1\printer1
skip 1
netprt \\server2\printer2 //skips to here
exit
you can call it with a one-line batch file:
cscript \\my-dc-01\scripts\kshell.js \\my-dc-01\scripts\logon.kss
The first 3 lines check to see if the user logged in is user1, 2 or 3.
If the user is one of those three, the script installs printer2 on
server2. Otherwise it installs printer1 on server1. With printers, it
might make more sense to control which printer is installed based on the
computername rather than username.
I have commands for common functions like creating/copying/deleting
files and directories, mapping drives, adding routes, installing network
printers, putting up message boxes and allowing the button selected to
control program flow. It's very rudimentary as you can see, but you can
add or modify it to suit your needs. As it is, it should do what you
want. It's old, (wsh 2.0) so it should work on all versions of windows
from 2000 up without having to install a wsh update. I also have basic
do***entation. If you want a copy, email me (remove "nospam" from the
email address) and I'll send it to you. Offered as-is of course. Use at
your own risk. If you add anything useful (like "netsh" support), please
send me an updated copy.
....kurt
|