Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

printer script hell on windows 7

Posted on 2010-08-13
9
Medium Priority
?
3,748 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
  • 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
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

 
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

Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

Question has a verified solution.

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

Group policies can be applied selectively to specific devices with the help of groups. Utilising this, it is possible to phase-in group policies, over a period of time, by randomly adding non-members user or computers at a set interval, to a group f…
Compliance and data security require steps be taken to prevent unauthorized users from copying data.  Here's one method to prevent data theft via USB drives (and writable optical media).
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 …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

886 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