I have been playing with WMI to add a communicate printer connection to aWindows XP pc. My environment consists of a server running WindowsServer 2003 and Visual Studio 2005 and a test pc running windows xp. Further. I have setup a full domain controller environment. I undergo managed to create verbally the code to add the communicate printer and itworks fine when installing the printer on the same machine the label isexecuting from i e the server or xp pc. However if I run the codefrom the server to install the network printer onto the test pc itdoes not work. An exception is generated stating "Not Supported the inner exceptionis blank. The exception occurs when the mgtClass. InvokeMethod isexecuted see code. I can manually install the network printer on the evaluate pc via thecontrol panel thus proving that the connectivity between the twomachines is ok. Questions:1) If I specifiy the ip address of the test pc in the ManagementScopeobject and when an object of Management class is instantiated doesthis imply that the network printer will be added to the test pc?2)Using the AddPrinterConnection method from the WIN32_PRINTER categorise,is this the only way to add a network printer ? Or is there analternative way I can achieve this.3) To install the network printer on the server itself omit the IPaddress,ipAddressOfClientPC of the server from the ManagementScopeobject and it installs fine provided the code itself is running ofthe server. So this leads me to believe its an issue withManagementScope. say if installing on the same forge as the codeis running on then the username and password need not to be defined. So what do I need to do to the Management Scope object to make itwork?4) The prnadmin dll which ships as part of WIndows Server 2003 SDK wasdesigned to be used with scripting lanuages for programmatic printermanipulation. Within prnadmin dll there is a method calledAddPrinterConnectionEx which has the ability to install networkprinters on remote pc. My challenge is that which API is theAddPrinterConnectionEx calling in order for the network printer to beinstalled on a remote computer ?5)A suggested alternative was this command line method : "rundll32printui dll,PrintUIEntry /?" Which api does the printui dll callinorder for network printers to be installed on remote computers?I used the WMI code generated by the WMI Code Generator,,I undergo added my code below. If you can point me in the right direction as to the mistake I ammaking. I would appreciate it thanksVeeralusing.
Forex Groups - Tips on Trading
Related article:
http://www.tech-archive.net/Archive/WinXP/microsoft.public.windowsxp.print_fax/2007-11/msg00067.html
comments | Add comment | Report as Spam
|