Solved

printer script hell on windows 7

Posted on 2010-08-13
9
3,700 Views
Last Modified: 2012-08-13
Hello,
Can someone please shed the light on this for me.
Below is my script that runs/ran perfect on Win XP, but on Windows 7 it will not.
If I run the script on the machine from the network (in a share), it runs just fine.
The driver accept prompt comes up and all is well.
But when I run the script from a GPO, no luck.
The GPO is set for loopback/merge.
The error that I receive is: Line 28, environment  is incorrect 8007000A

We are running windows 2003 R2 server.
We print via computer, not user.
If there is a better way to script this, I am all in favor.
This is a bit high priority, so whatever works...

Thanks a bunch.
Rem Script created: 28.08.2007 18:07
Rem Author: 

'Generic printer mapping for assinging printers to ou's
'The printers are all on PRINTSERVER
'Faculty Printers

Option Explicit
Dim objNetwork, str1stflrpr1, str2ndflrbw, stradmissbw, stradmisscol
Dim stradhead, strbaronrm, strclabpr1, strcollegepr1, strdeansoffice, strdevpr1
Dim strfacrmpr1, strlibmain, strrecepr1

str1stflrpr1 ="\\PRINTSERVER\1STFLRPR1"
str2ndflrbw ="\\PRINTSERVER\2NDFLRBW"
'stradmissbw ="\\PRINTSERVER\ADMISSBW"
stradmisscol="\\PRINTSERVER\ADMISSCOL"
'stradhead="\\PRINTSERVER\AHEAD"
strbaronrm ="\\PRINTSERVER\BARONRM"
strclabpr1="\\PRINTSERVER\CLABPR1"
'strcollegepr1="\\PRINTSERVER\COLLEGEPR1"
'strdeansoffice="\\PRINTSERVER\DEANSOFFICE"
'strdevpr1="\\PRINTSERVER\DEVPR1"
strfacrmpr1="\\PRINTSERVER\FACRMPR1"
strlibmain="\\PRINTSERVER\LIBMAIN"
'strrecepr1="\\PRINTSERVER\RECEPR1"
'Line 26
Set objNetwork = CreateObject("WScript.Network")
objNetwork.AddWindowsPrinterConnection str1stflrpr1
objNetwork.AddWindowsPrinterConnection str2ndflrbw
'objNetwork.AddWindowsPrinterConnection stradmissbw
'objNetwork.AddWindowsPrinterConnection stradmisscol

'objNetwork.AddWindowsPrinterConnection stradhead
objNetwork.AddWindowsPrinterConnection strbaronrm
objNetwork.AddWindowsPrinterConnection strclabpr1
'objNetwork.AddWindowsPrinterConnection strcollegepr1

'objNetwork.AddWindowsPrinterConnection strdeansoffice
'objNetwork.AddWindowsPrinterConnection strdevpr1
objNetwork.AddWindowsPrinterConnection strfacrmpr1

objNetwork.AddWindowsPrinterConnection strlibmain
'objNetwork.AddWindowsPrinterConnection strrecepr1

'WScript.Echo "Check the Printers Folder for : " & strUNCPrinter
objNetwork.SetDefaultPrinter strfacrmpr1

WScript.Quit

Open in new window

0
Comment
Question by:MARIANAPOLIS
[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
  • 4
  • 4
9 Comments
 
LVL 1

Expert Comment

by:odd lie
ID: 33433142
Yuo might try to run windows 7 as XP and in that VirtualPC run the script and see if that works.

Oldelphi
0
 

Author Comment

by:MARIANAPOLIS
ID: 33433176
There is no virtualPC on the computer.  That would be a bit hard to do on all of our clients.
I may be understanding this answer incorrectly.

Thank-you
0
 
LVL 33

Expert Comment

by:digitap
ID: 33433840
Add this after your declared variables then test your script again.

Set WSHNetwork = WScript.CreateObject("WScript.Network")
0
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
LVL 33

Expert Comment

by:digitap
ID: 33433843
never mind...i see that you have that already...
0
 

Author Comment

by:MARIANAPOLIS
ID: 33445386
I am still getting the same error.  I put the set objNetwork = CreateObject("Wscript.network") right below the declaration.

Does anyone suggest using a different script or a different method.
Is there an add-on that would fake 2003 into being a 2008 server to enable preferences?

Thank-you
0
 
LVL 33

Accepted Solution

by:
digitap earned 500 total points
ID: 33445482
Looking through your script again, I see that you don't have any error handling.  within your script, insert after Option Explicit

On Error Resume Next

It may not be all the printers that are causing trouble, it may only be the one.  However, since it's erroring on the first one and stopping the script, you'll never know.  Try it and let me know how it goes.
0
 

Author Closing Comment

by:MARIANAPOLIS
ID: 33445694
Thank-you to everyone
0
 

Author Comment

by:MARIANAPOLIS
ID: 33445707
The loopback seemed to be also giving me some issues.
Once putting the printer script strictly in the startup GPO, all was fine.
The error checking was also a valuable asset.

0
 
LVL 33

Expert Comment

by:digitap
ID: 33445743
glad we could help and thanks for providing feedback about what solved the issue.  thanks for the points!
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
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 …

734 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