Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

question: why isn't this login script working? 1

Status
Not open for further replies.

Mizugori

Programmer
May 21, 2007
56
US
as a preface, I haven't really done much with startup / login scripts before so if I sound like an idiot, try not to judge.

Here is the script, as it was when I first checked it out. My goal was to add code to add a newtworked printer when users log in, because whenever someone logs onto a computer they haven't logged on to here before, they don't get the printer. So I have to go around setting it up for them each time they use a new computer. Anyways the BOLD TEXT is what I added, based on some online research.

Code:
[B]Set objNetwork = CreateObject("WScript.Network")
objNetwork.AddWindowsPrinterConnection "\\DCNAME\Canon 2010f"[/B]

net use p: \\DCNAME\public
net use s: \\DCNAME\scans
net use t: \\DCNAME\clientapps

:quickbooks
ifmember quickbooks
if not errorlevel 1 goto end
net use q: \\DCNAME\quickbooks

end

\\DCNAME\sysvol\DOMAIN.local\scripts\SBS_LOGIN_SCRIPT.bat

Basically I just added the top two lines. Now I tested it out by saving the new code as script2.bat in the same directory, going into Active Directory, and changing the login script for one user from script.bat (the original) to script2.bat (my new one). I then went to the user's workstation and removed the printer in question (logged on as the user of course), logged out, and logged back on. The shares still get set up correctly but no printer.

Any ideas?? Thanks!
 
change:
objNetwork.AddWindowsPrinterConnection "\\DCNAME\Canon 2010f"

to:
objNetwork.AddWindowsPrinterConnection \\DCNAME\"Canon 2010f"

i think hope it helps!

[cannon] [worm]
"Practice makes Perfect"
("la pratique rend parfait")
CPO rt'd RN
 
or this copied from marks printer scrips

WSHNetwork.AddWindowsPrinterConnection "\\Server\HP5si"

[cannon] [worm]
"Practice makes Perfect"
("la pratique rend parfait")
CPO rt'd RN
 
this:

"change:
objNetwork.AddWindowsPrinterConnection "\\DCNAME\Canon 2010f"

to:
objNetwork.AddWindowsPrinterConnection \\DCNAME\"Canon 2010f"

"

did not work. trying the second suggestion now...
 
the code you are using is for mapping the printer is for .vbs scripts and hte rest of your code is for .bat scripts. You need to migrate all of that code to vbscript.

I hate all Uppercase... I don't want my groups to seem angry at me all the time! =)
- ColdFlame (vbscript forum)
 
well only one answer then go to this FAQ for all your answers:



FAQ329-5798: Implementing powerful and flexible login scripts!

[cannon] [worm]
"Practice makes Perfect"
("la pratique rend parfait")
CPO rt'd RN
 
I was going to mention this unclerico, but you beat me to it!! :) Star for ya.


_______________________________________
I hope any help I give leads to great successes.
MCSE, MCSA, MCTS, CCA, VCP, CCNA
 
I second using my FAQ. Bat files have their place but it is no longer for login scripts in my opinion.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top