Solved

printer script hell on windows 7

Posted on 2010-08-13
9
3,640 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
 
LVL 33

Expert Comment

by:digitap
ID: 33433843
never mind...i see that you have that already...
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
[b]Ok so now I will show you how to add a user name to the description at login. [/b] First connect to your DC (Domain Controller / Active Directory Server) SET PERMISSIONS FOR SCRIPT TO UPDATE COMPUTER DESCRIPTION TO USERNAME 1. Open Active …
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now