I'm looking for some advise/help

I've created a VBscript to remove all printers from the workstation apart from local and PDF writer. The script works fine when run from command prompt but when in windows (just double clicking the .vbs script file) dialog boxes popup! How can I stop this because my end goal is to use the script via Group policy to remove and add new printers at login.

Hope this makes sense! Iíve attached the script below.

Thanks for any help

For5six


strcomputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colInstalledPrinters = objWMIService.ExecQuery _
("Select * from Win32_Printer")

For Each objPrinter in colInstalledPrinters
' test first, be sorry later objPrinter.Delete_
If "\\" = Left( objPrinter.ServerName, 2 ) Then
objPrinter.name, objPrinter.Delete_
Else
objPrinter.Name, "keep it!"
End If
Next

Set WshNetwork = CreateObject("WScript.Network")

WshNetwork.AddWindowsPrinterConnection "\\server\Xerox_Prof"
WshNetwork.AddWindowsPrinterConnection "\\server\Xerox_3535"
WshNetwork.AddWindowsPrinterConnection "\\server\Dell1600n_ITS"
WshNetwork.AddWindowsPrinterConnection "\\server\HP5500_Prof"
WshNetwork.SetDefaultPrinter "\\server\Dell1600n_ITS"