|
|
|||||||
Code:
Above is the code I came up with to display the default printer, the only problem is that it wont display networked printers under the person whose logged in's profile if you know what I mean. Can any of you WMI experts help me out? |
||||||||
|
|
|||||||
You are impersonating to a remote connection. Network printers is a user specific setting, with network permissions you will only get A) network printers that YOU connected while on THAT PC, or B) network printers that the Local System account has, i.e. none Unless someone has another trick, WMI will not be the way. |
||||||||
|
|
|||||||
I am gussing there is a registry key somewhere under HKCU then...but I like WMI!! *cry* |
||||||||
|
|
|||||||
Is "gussing" like cussing? Yes there is reg key under HKCU but HKCU is smoke and mirrors so it does not exist remotely. |
||||||||
|
|
|||||||
hkusers\(sid of remote current user) NOT @sid, as that is you |
||||||||
|
|
|||||||
If we look at - KiXtart FAQ & How to's We find: Default Printer Configuration This is not as "elegant" as WMI, but gets the job done. Kent |
||||||||
|
|
|||||||
Here is a UDF to return all the printer connections. EnumPrinterConnections2() - Enumerates all connected printers And here is some code to display the current Default Printer Code: Break On These methods require you to run this and log it during the logon process. Otherwise you would need to remotely load the users profile, or use an @SID method WHILE the remote user is actively logged on. |