Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

printer script hell on windows 7

Posted on 2010-08-13
9
Medium Priority
?
3,735 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
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
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 2000 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

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

Microsoft Office 365 is a subscriptions based service which includes services like Exchange Online and Skype for business Online. These services integrate with Microsoft's online version of Active Directory called Azure Active Directory.
A bad practice commonly found during an account life cycle is to set its password to an initial, insecure password. The Password Reset Tool was developed to make the password reset process easier and more secure.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
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.
Suggested Courses

718 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