I am trying to create an application that will execute a VB script to identify the default printer and capture LPT1 to that printer. I have the script that does just that and works well when it is ran locally on the PC.

The problem is, when I package the script in a NAL app, always identifies a local printer as the default, even when the default is a network printer, and the capture fails. I have tried copying the script to the local machine and then using a batch file to call it but same result.

Here is the script that I'm using:

Set WshNetwork = CreateObject ("WScript.Network")
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colInstalledPrinters = objWMIService.ExecQuery _
("Select * from Win32_Printer where Default = 'True'")
For Each objPrinter in colInstalledPrinters
Wscript.Echo "Name: " & objPrinter.Name
WshNetwork.AddPrinterConnection "LPT1", objPrinter.Name

set objWMIService = Nothing
set colInstalledPrinters = Nothing

Any ideas will be greatly appreciated.