question: why isn't this login script working?

Mizugori

Senior member
May 3, 2007
496
0
0
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!
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,838
4,817
75
I haven't really done much with startup / login scripts either, but it looks like you're trying to use VBScript in a batch file context. Can you try making a separate vbscript file and running it with wscript?