question: why isn't this login script working?

Mizugori

[H]ard|Gawd
Joined
Mar 25, 2004
Messages
1,240
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!
 
You can't put VBScript code in a .bat file. VBScript is one "language" while command line "scripting" is another. You can call a VBScript from a batch file, or a batch file from a VBScript, but you cannot combine the code into a bat file and expect it to work.


Remove the first two lines and add the following:

Code:
NET USE \\DCNAME\Canon 2010f
 
still doesn't work >< going crazy...

tried all of these:

net use \\dcname\Canon 2010f
net use "\\dcname\Canon 2010f"
net use \\dcname\"Canon 2010f"
net use \\dcname\CanoniR1
net use "\\dcname\CanoniR1"
net use \\dcname\"CanoniR1"

Canon 2010f is the name that shows up under printers and faxes when it is installed correctly; CanoniR1 is the name that is listed under the sharing tab (for the record I did not set this office up originally. the guy who did was totally inconsistent)
 
A quick check here suggests that you should use the share name ( ex: "\\dcname\CanoniR1" or \\dcname\CanoniR1 ).

Given the simplicity of the line and the problems going on, I'm left wondering about user permissions. Is the user account running the script assigned to the printer share or the group listed in the printer share?(Printer Properties, Security Tab)
Checking the "Effective Permissions" tab would be one quick way to know.
 
which permission is needed to add the printer? everyone has the "print" box checked but nothing else - no manage printers, no manage documents.

I'm guessing it's manage printers, but what else does that let them do? I don't want to open a security hole here
 
which permission is needed to add the printer? everyone has the "print" box checked but nothing else - no manage printers, no manage documents.

I'm guessing it's manage printers, but what else does that let them do? I don't want to open a security hole here
"Everyone" and "print" should normally be sufficient. But did you check the "Effective Permissions" like I previously mentioned? What was presented after checking that? From an AD level, what else is different for this user (groups, etc.) versus a comparable user account that works?
 
I did check, it shows everyone has print and read permissions under effective perms
 
Just for fun, try this from a command prompt

net use \\dcname\Canon2~1

edit: or net use lpt2: \\dcname\Canon2~1
 
Last edited:
first one: the network path was not found

second one: system error 66 has occurred, the network resource type is not correct
 
Why not call a VBScript with the code you had in your first post?

Create a file named CanonPRT.vbs add your two lines of code:

Set objNetwork = CreateObject("WScript.Network")
objNetwork.AddWindowsPrinterConnection "\\DCNAME\Canon 2010f"

Store it in your scripts directory (\\DCNAME\sysvol\DOMAIN.local\scripts)

then add a line to run that in your batch file:
\\DCNAME\sysvol\DOMAIN.local\scripts\canonprt.vbs
 
Back
Top