How-to: Re-Install Existing Printers on Windows using VBScript
Preferred Editor: Notepad++
Microsoft VBScript: Language Reference
Sometimes Windows, for reasons unknown, gets confused about printers. This is a problem in an office environment where people are printing almost non-stop. At my work we have about thirty employees, and in approximately six months, they’ve printed over 100 000 pages. I know this because one of the ink cartridges in the printer was recently replaced, and the printer keeps tabs on these kind of stats.
Anyway, an issue we sometimes encounter is that peoples printers simply don’t work. When they’re selected in the print dialogue of whatever application, the application locks up while the operating system tries to remember where the printer really is. I have no idea what causes this; if you do, please drop me a comment. In an effort to avoid this kind of behaviour, I’ve made an addition to our login script that removes and re-installs all the printers on the system. Hopefully by keeping the printers “fresh” in this way, I can avoid having peoples’ time wasted by silly, preventable printer problems.
The Script
-
-
’setup-printers.vbs
-
‘deletes and re-adds printers that already exist on the client system
-
Set objNetwork = CreateObject("WScript.Network")
-
‘the EnumPrinterConnections method returns an array containing the printer name and its UNC connection string
-
‘ood array indices are the names, even array indices are the connection strings
-
Set printers = objNetwork.EnumPrinterConnections
-
‘For all printers
-
For i = 0 to printers.Count-1 Step 2
-
Dim currentPrinter
-
‘Remove
-
currentPrinter = printers.Item(i+1)
-
If Left(currentPrinter, 2) = "\\" Then
-
‘ we have a network printer
-
On Error Resume Next
-
objNetwork.RemovePrinterConnection printers.Item(i+1)
-
Else
-
‘do nothing
-
End If
-
‘Re-add
-
currentPrinter = printers.Item(i+1)
-
If Left(currentPrinter, 2) = "\\" Then
-
‘ we have a network printer
-
On Error Resume Next
-
objNetwork.AddWindowsPrinterConnection printers.Item(i+1)
-
Else
-
‘do nothing
-
End If
-
Next
-
‘ setup the Edgeline as default printer
-
objNetwork.SetDefaultPrinter "\\springwood\HP CM8060 MFP with Edgeline PS"
-
Essentially, what the code does is grab the existing printer connections, delete them, and then re-add them. The in-code comments are enough to satisfy anyone with a web browser capable of looking up Microsoft’s VBScript references. What may not be immediately obvious is the last part — the script will re-add them in the order they existed, but without further input, will make the last added printer the default printer. This isn’t what we’re after at my workplace, therefore we need to fix that. However, I’ve just figured that in my particular instance I could re-add the printers in reverse — problem solved!
2 commentsMicrosoft bundling & OEMs
It’s pretty bullshit. Just picked up a new laptop with Vista Home Premium pre-installed. First impressions: grim. I’m at the screen where it prompts you to accept the licencing terms to use the laptop. Funny thing is, you can’t do anything but accept them. It’s either: accept and use the computer, or, just sit staring at the screen. There isn’t an option of, “No, I do not accept, please uninstall Windows from my PC” like you’d have if you didn’t accept the EULA of a particular piece of software.
Of course, if Microsoft included that option, they might find their market share dented somewhat. Which is exactly why they don’t include it. I’m going to format and put XP on it anyway, but that’s not the point. Non-technical users should be given a choice. 99% of the time they’ll hit “yes” without a second thought (without any thought at all for some), but that other one percent, maybe they’ll wise up…
No commentsDRM, Vista and your rights — excellent article
There’s an excellent article titled DRM, Vista and your rights doing the rounds lately that I think everyone should have a read of. It nicely summarizes most of the problems facing the regular people, you and I, when it comes to DRM and big corporation’s plans for personal computing in the future.
Frankly, I think they can go and get fucked, but you should read the above article, which is written in a more user-friendly language. ^_^
1 commentProtected: MotherLAN II
Protected: MS06-049: patch KB920958 data loss bug
Protected: Microsoft cuts HDCP playback from 32-bit Vista
Protected: MS06-040: the aftermath
Still using Windows 98?
Are you still using Windows 98, despite its support termination, and consequent security, functionality and usability deficiencies?
This from Microsoft’s security bulletin website, here:
Affected Software:
- Microsoft Windows 2000 Service Pack 4 – Download the update
- Microsoft Windows XP Service Pack 1 and Microsoft Windows XP Service Pack 2 – Download the update
- Microsoft Windows XP Professional x64 Edition – Download the update
- Microsoft Windows Server 2003 and Microsoft Windows Server 2003 Service Pack 1 – Download the update
- Microsoft Windows Server 2003 for Itanium-based Systems and Microsoft Windows Server 2003 with SP1 for Itanium-based Systems – Download the update
- Microsoft Windows Server 2003 x64 Edition – Download the update
- Microsoft Windows 98, Microsoft Windows 98 Second Edition (SE), and Microsoft Windows Millennium Edition (ME) – Review the FAQ section of this bulletin for details about these operating systems.
This security problem WILL NOT be fixed in Windows 98, 98SE or ME. Third-party applications such as virus scanners, spyware scanners/blockers and such are technically incapable of preventing harm to your system from this exploit. As a result, you could have your important personal data wiped due to some script kiddie having fun via remote control of your system. Worse yet, there are approximately 50 - 70 million Windows 9x systems in operation today. If even just five per cent of those were infected with botnet software, the target of such a botnet attack would be in dire consequences.
So, are you wondering what your upgrade path is now that, in all likelihood, if you went the XP route, you’d probably have to upgrade some hardware components as well? Well, wonder no further. Your upgrade path is simple; though perhaps not straightforward. More like taking a sidestep onto an escalator, watching XP whizz by below you.
I’m talking about Linux. Not only is an upgrade to Linux free (as in freedom, and free as in without cost), it will more than likely save you any hardware hassles as well. Although XPs hardware support is greatly improved over its predecessors (especially Windows 98 and ME), its the speed and capacity of your hardware that matters. Sure, you can “run” WindowsXP on an old Pentium with EDO RAM — I’ve done it — you can even “run” the XP operating system on an 8Mhz Pentium with 20Mb of RAM, if you’re willing to put up with 30 minute boot times and unpredictable load times for applications; but the point is, to run Windows XP at a pace acceptable for most users, while being able to have several applications open concurrently, you’re going to want at least an 800Mhz CPU, 256Mb or more of memory, and about 5Gb of hard-drive space (when you include Office, Windows’ swapfile, space for suspend-to-disk hibernation, etc).
Obivously, I’m not the only one who’s given thought to this, with a write-up over at ZDNet talking about the very idea. Thankfully, it’s not all bad, with Micahel C. Barnes at DesktopLinux.org producing a nice tutorial-style write up concerning Windows 98 users upgrade path to SimplyMEPIS. Of course, our thoughts are shared by bloggers around the ‘net.
If you’re a tech-headed sort of person and you know someone with a Windows 98 box, tell them you can upgrade their software for free. Tell them their system will be secure and they won’t have to worry about viruses, spyware or malware anymore. Tell them their system will be more stable and have greatly increased functionality and customisability. If they have a slow system, more than likely they aren’t playing any big-name, modern games on it anyway, so there really is no reason for Windows 98 users not to upgrade to some flavour of Linux.
If you’re a Windows 98 user looking to escape the Microsoft tax, then you’re best off going with Ubuntu in my opinion. It’s stormed up the ranks of ‘most popular’ distro in just under a year, and has widespread acclaim from new users and veteran UNIX administrators alike. With that comes widespread support and an excellent community, based around their forums and their wiki.
So, there you have it. Upgrade your operating system to Linux and you won’t have to worry much anymore, as Linux will always be free (free as in freedom, and free as in without cost), will always be supported, and will always be better than Windows 98 or ME.
6 commentsUbuntu + VMWare Server + WindowsXP + me equals?
This:
Thanks to Peturrr’s excellent HOWTO, I’m running VMWare Server under Ubuntu, and it works very well. I’ve installed XP so that I can do a few Windows-specific things, like open Powerpoint documents that don’t play nice with OpenOffice, use etax, and such. Of course, I got bored, and decided to experiment a little.
As you can see from the screenshot, that is Valve’s TFC running in XP, inside of the VMWare Server Monitor. It runs quite well in 1024×768; my Athlon64 3400+ is able to push out around 25-35fps; though there is one problem. Unfortunately mouse input is somehow garbled by VMWare server, such that moving the mouse on my mousepad as little as 1-2 millimetres results in several 360-degree turns and random pitching from the player’s FOV in the game. Turning the sensitivity to minimum (1.0) in TFC didn’t help one iota; no doubt it’s a VMWare-combined-with-XP-combined-with-software-rendering-of-old-games issue.
Installing Linux has probably been the best thing I have done on my computer in a while; I was getting bored with the same-old, same-old that I used to do within Windows: chat, e-mail, internet forums, music, game. Now, I do all those things, and more: tinker, compile, learn, tweak, and get frustrated (sometimes) — but, it makes the experience all the more authentic, and worth my time. Linux is fun, believe it or not. :-)
Anyway, if anyone has any ideas how can fix the strange mouse issues, leave a comment. I really would like to play TFC! :-)
5 commentsWindows 98/ME/NT and Windows XP SP1 Support Termination
Support for Microsofts’ ageing Windows 9x series of operating systems, Windows NT and Windows XP SP1 will all end this year, presumably in preparation for the release of Vista sometime early next year.
This is a problem. Though this problem is larger than you may think; not only are the ‘mum and dad’ users of computers being stiffed (50 to 70 million estimated computer systems worldwide are still running Windows 98 or Windows ME [1], and all of which can potentially become part of a massive botnet), educational institutions (public schools and the like) who cannot afford to pay the expensive Microsoft Tax — those still running their educational networks on Windows 98 and alike — are going to be hit hardest by this.
And won’t I know it.
I do casual IT support at a local primary school which caters to the educational needs of special children, consequently it is a small school (maybe 30-40 students in all) and the majority of their computers are donated. We’ve got everything from Pentium 200Mhz systems right up to Pentium 4 3Ghz systems, and everything in between. Most of them are running Windows 98; some are running Windows 95; and the rest are running various versions of Windows XP; SP1 and SP2.
Due to the fact that official Microsft support for Windows 98 and ME has ended as at July 11th 2006 [2], and support for Service Pack 1 under WindowsXP will be dropped as at October 10th 2006 [3], Aspley Special School is going to have to undergo some changes in their software repository.
What I have in mind is something that I doubt will be easy to implement, but this ease of implementation I am presuming will have nothing to do with the software itself, or the hardware for that matter, but it will be entirely because of red tape and psychological issues. What I would like to do is install Edubuntu school-wide for all of the students to use. The existing WindowsXP installations would remain (as these XP machines are used by the teachers). The problems facing me, I am guessing, would be due to licencing issues and the availability of the appropriate educational software for students under the Linux operating system.
But, I will endeavour to produce a table of comparison between existing software solutions (Windows 98 and third-party educational software suites versus Edubuntu and its associated educational software suites). Hopefully I can produce a meaningful comparison and prompt a conversion.
2 comments
