Scripts Thread, Working Script suddenly Not! - Help Needed! in Coding and Web Development; Hi Guys & Girls,
I’ve been asked to rectify a script related problem and was wondering if anyone else had ...
-
14th September 2009, 10:18 AM #1
Working Script suddenly Not! - Help Needed!
Hi Guys & Girls,
I’ve been asked to rectify a script related problem and was wondering if anyone else had experienced similar.
The usual story; the script has been running without problem for months. Some upgrade work has been done on the (school) network and now it has stopped working.
No changes have been made to the script.
All servers/paths/printers/shares referenced by the script are available.
Script now throws random errors and does not execute ie:
Line: 9
Char: 1
Error: 0x80041001
Source: (null)
Or:
Line: 10
Char: 5
Error: 0x80041002
Source: SWbemObjectEx
(same script both times)
A Sample of the script is below. In essence the first part strips out all network printers, and the second part adds network printers. This is done as a user moves from room to room and different printers become available.
Any ideas why the script does not run, syntax seems fine, but maybe it’s not? - and the knowledge that is has been running (apparently) fine for months just confuses matters further!
Thanks !
Robin.
--------------------------
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colInstalledPrinters = objWMIService.ExecQuery _
("Select * From Win32_Printer Where Network = True")
For Each objPrinter in colInstalledPrinters
objPrinter.Delete_
Next
Dim oNetwork, sPrintPath, sShort
Set oNetwork = CreateObject("WScript.Network")
sShort = Left (oNetwork.ComputerName, 4)
Select Case sShort
Case "204A"
sPrintPath = "\\support\LaserJet -204A-"
Case "204B"
sPrintPath = "\\support\Laserjet -204B-"
Case "204C"
sPrintPath = "\\support\LaserJet -204C-"
Case "64_A"
sPrintPath = "\\support\Laserjet -64A-"
Case Else
WScript.Quit
End Select
oNetwork.AddWindowsPrinterConnection sPrintPath
oNetwork.SetDefaultPrinter sPrintPath
-----------------------
-
-
IDG Tech News
SHARE:
Similar Threads
-
By Andie in forum Windows
Replies: 23
Last Post: 19th May 2011, 09:28 PM
-
By link470 in forum Windows
Replies: 0
Last Post: 3rd February 2009, 07:07 AM
-
By contink in forum Scripts
Replies: 15
Last Post: 11th June 2008, 10:40 AM
-
By FN-GM in forum Scripts
Replies: 14
Last Post: 27th March 2008, 05:57 PM
-
By tosca925 in forum Educational Software
Replies: 1
Last Post: 30th October 2007, 03:54 PM
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules