cbossert
asked on
Printer Login Script Modification?
Experts,
I have this printer script that works perfectly:
REM Add printer
echo Installing [Xerox] on [troy]
RunDll32.EXE printui.dll,PrintUIEntry /in /n "\\troy\4th FL Xerox 7675"
echo Your default printer is [Xerox] on [troy]
REM Add printer
echo Installing [Xerox] on [troy]
RunDll32.EXE printui.dll,PrintUIEntry /in /n "\\troy\Intake Xerox 5030"
echo Your default printer is [Xerox] on [troy]
REM Add printer
echo Installing [Xerox] on [troy]
RunDll32.EXE printui.dll,PrintUIEntry /in /n "\\troy\3rd FL Xerox 7675"
echo Your default printer is [Xerox] on [troy]
rundll32 printui.dll,PrintUIEntry /dn /n"\\appserver\Xerox Copyroom" /q
rundll32 printui.dll,PrintUIEntry /dn /n"\\appserver\Xerox 3rd Floor" /q
rundll32 printui.dll,PrintUIEntry /dn /n"\\appserver\HP Color LaserJet 4650 PCL 6" /q
Is it possible to add extra code that will stop it from running on 1 computer? I have a terminal server that is locked down and when a TS user logs into the terminal server the restrictions stop these printers from being installed but they have to click ok three times to the "you don't have permission" box that pops up at login. I would like to exclude this 1 computer so that they dont get this error.
If this is not possible just let me know. I would like to do this via script.
Thanks!
I have this printer script that works perfectly:
REM Add printer
echo Installing [Xerox] on [troy]
RunDll32.EXE printui.dll,PrintUIEntry /in /n "\\troy\4th FL Xerox 7675"
echo Your default printer is [Xerox] on [troy]
REM Add printer
echo Installing [Xerox] on [troy]
RunDll32.EXE printui.dll,PrintUIEntry /in /n "\\troy\Intake Xerox 5030"
echo Your default printer is [Xerox] on [troy]
REM Add printer
echo Installing [Xerox] on [troy]
RunDll32.EXE printui.dll,PrintUIEntry /in /n "\\troy\3rd FL Xerox 7675"
echo Your default printer is [Xerox] on [troy]
rundll32 printui.dll,PrintUIEntry /dn /n"\\appserver\Xerox Copyroom" /q
rundll32 printui.dll,PrintUIEntry /dn /n"\\appserver\Xerox 3rd Floor" /q
rundll32 printui.dll,PrintUIEntry /dn /n"\\appserver\HP Color LaserJet 4650 PCL 6" /q
Is it possible to add extra code that will stop it from running on 1 computer? I have a terminal server that is locked down and when a TS user logs into the terminal server the restrictions stop these printers from being installed but they have to click ok three times to the "you don't have permission" box that pops up at login. I would like to exclude this 1 computer so that they dont get this error.
If this is not possible just let me know. I would like to do this via script.
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
lol, must learn to type quicker ;-)
use a vbs script to install your printers (on windows 2000+)
you can use the network object to have the name of the person who is logging
ass this to the script:
if usenam="theguy.iwantomappr inter" then
'add printer here
end if
my whole logon script is in this post:
(in case i forget something, like a object definition)
https://www.experts-exchange.com/questions/23486974/Problems-with-login-script.html
you can use the network object to have the name of the person who is logging
ass this to the script:
if usenam="theguy.iwantomappr
'add printer here
end if
my whole logon script is in this post:
(in case i forget something, like a object definition)
https://www.experts-exchange.com/questions/23486974/Problems-with-login-script.html
'------------vbs file-----------
'=== network groups (pas le login) avec tous les CN, OU, DC
Set objUser = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & objUser.UserName)
'=== network usename
usenam = lcase(objNet.UserName)
uselna = lcase(currentuser.sn) '=== last name
usefna = lcase(currentuser.givenname) '=== first name
'=== remark in front, to test script, so error can show up
'on error resume next
Set objNet = CreateObject("WScript.Network")
'=== printer server name
serv01 = "\\printerserver\"
'=== printer name
a = "hpprintername"
'=== server + share name for the drive to map
b = serv01 & a
objNet.RemovePrinterConnection b
objNet.AddWindowsPrinterConnection b
'=== end of printers
'=== mapping of network drives done
oops i tought you said stopping from one user
anyway my initial script chek for computer name too
you can code a great logon script in vbs
more possibilities than any .bat file
anyway my initial script chek for computer name too
you can code a great logon script in vbs
more possibilities than any .bat file
we use vbs but are moving to perl,
There are situations in which a bat file is more appropriate. Just as there are situations that Perl makes things easier... the point in languages is that each has their place.
In this case, the original code is a batch file. The asker says it works well, he would just like a minor change. As the minor change is adding two lines to the code, it makes sense to stick with the batch file instead of rewriting it in VBS - in my opinion.
Though all my printer installation scripts are also in VBS.
In this case, the original code is a batch file. The asker says it works well, he would just like a minor change. As the minor change is adding two lines to the code, it makes sense to stick with the batch file instead of rewriting it in VBS - in my opinion.
Though all my printer installation scripts are also in VBS.
ASKER
NICE!! That was all I was looking for and it works great!!
Thank you mastertech!!
Thank you to the rest of you experts for your comments, but this is what I wanted/needed.
cbossert
Thank you mastertech!!
Thank you to the rest of you experts for your comments, but this is what I wanted/needed.
cbossert
you are right purplepomegranite, this user will accept your solution
since mine is incomplete and will make him work more hehe
but i like to post thoses .vbs files, so poeple can see a wider range of possibilities
it's their call, to use them or not, even though thy should get your solution, by respect
since mine is incomplete and will make him work more hehe
but i like to post thoses .vbs files, so poeple can see a wider range of possibilities
it's their call, to use them or not, even though thy should get your solution, by respect
lol, not my solution, I was beaten to it, so quite rightly the points have been given to mastertechnc.
VBS is a very powerful tool - and is one that I use more often than any other. But you shouldn't underestimate batch... it is a black art that comes into it's own in certain situations. :-)
VBS is a very powerful tool - and is one that I use more often than any other. But you shouldn't underestimate batch... it is a black art that comes into it's own in certain situations. :-)
*shiver*
are you trying to get more poeple to the dark side?
yoda would not like you :P
are you trying to get more poeple to the dark side?
yoda would not like you :P
Open in new window