Any ideas why I can't for the life of me get any code samples of any code
whether VB or dos commands using rundll32, to remotely set a default printer
on a Windows XP computer. I am using the code below:
strComputer = "remotecomputername"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colInstalledPrinters = objWMIService.ExecQuery _
("Select * from Win32_Printer Where Name = 'PrinterName'")
For Each objPrinter in colInstalledPrinters
objPrinter.SetDefaultPrinter()
Next
but it simply executes silently and does NOT set the default printer on the
remote machine. The values are not updated in this sample to show actual
computer or printer names. All the samples I find on this function execute,
but do not perform the required action on the remote PC. They work perfectly
fine locally.
So I guess my question is this even a supported function of VB and WMI to
remotely set a default printer? Is this a limitation or by design issue
where you just can't do that? And if so, does anyone have any suggestions on
how to accomplish this. I am trying to script the deletion of local printers
from Windows XP machines, the installation of new printer server based
printer shares on Server 2003, and the selecting of a default printer. I
have everything else working, but can't for the life of me get anything I try
to remotely set a default printer.
any help is greatly appreciated.
Thanks