VBS scrip error Code: 800708CA

Posted on 2011-10-18
Last Modified: 2012-05-12
Hello all,

I have this script below which works fine to remove a printer, but when the printer is removed and the printer is no longer mapped, the script produce an error. Is anyone know what I need to do to stop the error if the printer is not available ?

error msg:- " This network connection does not exist." Code: 800708CA

Option Explicit
Dim DelPrint, UNCpath
UNCpath = "\\printserver\printname"
Set DelPrint = WScript.CreateObject("WScript.Network")
DelPrint.RemovePrinterConnection UNCpath, true, true
Wscript.Echo "This printer was removed : " & UNCpath

Thank you
Question by:IT Department
    LVL 51

    Accepted Solution

    Add the line: On Error Resume Next

    Do this under the Option Explicit line.


    Assisted Solution

    by:IT Department
    Worked, I did use this line before but I gues I have it in the wrong place. Thank you for been specific.

    Author Closing Comment

    by:IT Department

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Are you one of those front-line IT Service Desk staff fielding calls, replying to emails, all-the-while working to resolve end-user technological nightmares? I am! That's why I have put together this brief overview of tools and techniques I use in o…
    I'm a big fan of Windows' offline folder caching and have used it on my laptops for over a decade.  One thing I don't like about it, however, is how difficult Microsoft has made it for the cache to be moved out of the Windows folder.  Here's how to …
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    760 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

    11 Experts available now in Live!

    Get 1:1 Help Now