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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SBS_LOGON_SCRIPT file calling a vbs file 2

Status
Not open for further replies.

amberlynn

Programmer
Dec 18, 2003
502
CA
In an attempt to automate printer setup on my network, I wrote a vbscript that did this.

I'm new to all this, and wasn't sure how to make it work.
I'm using SBS 2003 on my server.

I ended up adding the line: call "\\MCSS-SERVER\NETLOGON\printers.vbs" in my SBS_LOGON_SCRIPT.bat file. And this works.

I now have 2 questions.

1) is this the best way to do this? Is it okay that I've put this vbs file in my NETLOGON folder?

2) while I was messing around, trying to make this work - I at one point had my .vbs file named .bat and it was also sitting in the NETLOGON folder. It wasn't working then. When I reboot, I now get an application error in my event log that says: Could not execute the following script \\MCSS.local\NETLOGON\printers.bat. The system cannot find the file specified.
Why is it still looking for this file? It isn't referred to in the SBS_LOGON_SCRIPT.bat file.

Thanks!!
Amber
 
1. The only issue I see with putting the printers.vbs on netlogon is potential network traffic. Our printers.vbs are stored on the local machine.

2. My guess is that it can't find the file because of the period in MCSS.local. It may think the file is "MCSS.local\netlogon\printers.bat" because of the first encountered period.

-Geates
 
Thanks for the response.
So I'm clear - do you suggest putting a copy of printers.vbs on each PC on the network - then referring to that file?

And the printers.bat file in my second question no longer exists. When I was fooling around, trying to make my script run, I had named my printers.vbs to printers.bat. Then I changed it back and eventually figured out how to make it work. But now when I check my Application Events, on boot, I get the error I mentioned - it can't find the file because the file isn't there. What I dont' understand is why it's trying to find the file...

Thanks!
Amber
 
Well that really depends on the number of "unique" assets and number of printers. We have over 1500 computers and ~350 printers. The printers.vbs is local to each computer because each computer generally requires a different set of printers. This is also the reason I mentioned network traffic as a potential issue. If each computer gets the same printers, I don't see an issue with housing the script in NETLOGON.

It may sound trivial but, in regards to the "file not found" error, make sure SBS_LOGON_SCRIPT.bat isn't calling printers.bat. Your original post denies this as a culprit but you never know.

Also, you may want to consider changing your SBS_LOGON_SCRIPT.bat to a vbs script. It will run command simultaneously as opposed to line by line - waiting for the previous code to finish. I rewrote our login script and took execution time down from 45-75 secs to 2-10.

-Geates
 
Thanks.

The setup is ~15 PCs on a network that all require access to 2 specific printers. Some of the PCs were occasionally losing access to these printers, so I hoped this script would solve that.

I'm posting my current SBS_LOGON_SCRIPT.bat below. You'll see it contains no reference to a printers.bat file. (so I'm still not sure why it's trying to access this).

Something new I just discovered - when I log on to my server, I now get the error:
"Windows Script Host
Script: \\MCSS-Server\NETLOGON\printers.vbs
Line: 2
Char: 1
Error: The filename, direcotry name, or volume label syntax is incorrect.
Code: 8007007B
Source: (null)


Obviously I'm doing something wrong here.

rem ======================================================
rem LOG IN SCRIPT
rem
rem date: Feb. 17 2010
rem
rem author: Amber Hancock
rem ======================================================

:SBS_SETUP
\\MCSS-SERVER\Clients\Setup\setup.exe /s MCSS-SERVER

:pRINTERS
rem Call Printers VBS file
call "\\MCSS-SERVER\NETLOGON\printers.vbs"

:END
 
I'd replace this:
call "\\MCSS-SERVER\NETLOGON\printers.vbs"

with something like this:
cscript "\\MCSS-SERVER\NETLOGON\printers.vbs"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I changes the CALL to Cscript, and now I don't seem to get the error message on my Server, but I get the following on the client PCs when they log in to the server (in the applications events log):

What I need to find out is why and from where it's looking for printers.bat...

Could not execute the following script \\MCSS.local\NETLOGON\printers.bat. The system cannot find the file specified.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top