?
Solved

question: why isn't this login script working?

Posted on 2009-04-10
3
Medium Priority
?
366 Views
Last Modified: 2012-05-06
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
[/code]

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!
0
Comment
Question by:Mizugori44
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 85

Accepted Solution

by:
oBdA earned 480 total points
ID: 24115598
It isn't working because the lines you've inserted are VB script, not batch.
Easiest workaround for the time being: save these lines as Printers.vbs in the folder where your logon script already is, then add the following line to the logon script instead of these lines:

cscript /nologo "%~dp0Printers.vbs"

cscript /nologo "%~dp0Printers.vbs"
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

Open in new window

0
 
LVL 5

Expert Comment

by:mrmarkfury
ID: 24115611
Set objNetwork = CreateObject("WScript.Network")
objNetwork.AddWindowsPrinterConnection "\\DCNAME\Canon 2010f"

The preceding is for a .vbs script, not a .bat script as far as I know.

Try creating a .vbs in notepad, adding the two lines, and then linking that .vbs to run after the .bat.
0

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Organizations create, modify, and maintain huge amounts of data to help their businesses earn money and generally function.  Typically every network user within an organization has a bit of disk space to store in process items and personal files.   …
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question