Error 'the filename directory name or volume sytax is incorrect' with VB logon script

Posted on 2008-10-20
Last Modified: 2012-06-27
We currently have an office of about 30 computers setup in different OU's.  I need to be able to have the computers in the different OU's print to a default printer in each OU and still have the ability to print anywhere in the office.  Right now there is a total of 7 printers all on different computers with the printer shared.  I have done much reading on the subject and here is what I have come up with.  Now when I run this on any computer just as a file, it will map all of the printers just fine.  However, if I throw this in the GP for the OU, on startup the computer will throw an error "the filename directory name or volume sytax is incorrect".

I know nothing about VB and this is the first time I have tried to use it.  It seems odd to me that it would work fine just running the script, but it throws an error on startup.  It also appears to be applying properly as it is running on startup.  Any ideas would be great and here is the script I am using saved in the policies startup folder.  Thanks in advance.


Dim net
Set net = CreateObject("WScript.Network")
net.AddWindowsPrinterConnection "\\GAd1\GAd1-HP6940"
net.AddWindowsPrinterConnection "\\GFO3\GFO3HP1000"
net.AddWindowsPrinterConnection "\\GIns2\GIns2-HP 6940"
net.AddWindowsPrinterConnection "\\GSur2\GSur2-HP C4380 series"
net.AddWindowsPrinterConnection "\\JDoc1\JDoc1-HP1115"
net.AddWindowsPrinterConnection "\\JWk1\JWK1-Brother"
net.AddWindowsPrinterConnection "\\JWk1\JWk1-HP"

' Set the default printer now
net.SetDefaultPrinter "\\GAd1\GAd1-HP6940"

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
  • 4
  • 2

Expert Comment

ID: 22763264
Two things to check first. Is the logon script located in the NETLOGON share? (silly question) is the file saved with a .vbs extension?

Author Comment

ID: 22763475
Umm well does it need to be in the NETLOGON share?  By default it seems its looking for it in a different folder.  When I added the GP to the container I wanted to apply it to and then hit 'edit computer configuration\windows settings\scripts (startup/shutdown)\startup script', and add my VB script it has a folder in server.local\policies\{B55...}\machine\scripts\startup.  

It seems to be finding the actual script as it does indeed run when the computer starts.  Do I still need to but it in the NETLOGON share as well as the share it looks for?  Thanks for the response.

Author Comment

ID: 22768927
And in answer to your other question, yes it is saved with a VBS extension.
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.


Expert Comment

ID: 22770226
It doesn't need to be in the netlogon folder, its just the common folder for scripts on SBS. I would recommend trying to move the logon script to another folder and doing it that way.

Author Comment

ID: 22770453
Well I found out the reason that it was throwing me that error was because the script is being run on one of the computers where a printer is located.  If I delete the section of script for that computer, then it will run with no errors.  But it still is not actually applying any of the printer settings when a user logs into the computer.  I'm reading about loopback processing.  Is that what I need to do to the GPO?  Sorry if this all sounds confusing, but I have no idea how to use/setup scripts.

Accepted Solution

imperialcomputersolutions earned 0 total points
ID: 22787633
Alright, problem solved.  It seems that I just had the script in computer instead of user settings when editing the local policy.  After I moved it over it worked just fine.  

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

The problem of the system drive in SBS 2003 getting full continues to be an issue, even though SBS 2008 and SBS 2011 are both in the market place.  There are several solutions to this, including adding additional drive space or using third party uti…
Because virtualization becomes more and more common, and, with Microsoft Hyper-V included in Windows Server at no additional costs, and, most server hardware nowadays is more than capable of running a physical Small Business Server (SBS) 2008 or 201…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

739 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