开发者

How to fix the Win32_Printer.Default field so that it returns the correct value when using WMI remotely?

开发者 https://www.devze.com 2023-01-14 03:31 出处:网络
The Win32_Printer class returns a field per printer called Default (a boolean value). This works locally and accurately returns the Default printer. However when remotely connecting in with WMI, it al

The Win32_Printer class returns a field per printer called Default (a boolean value). This works locally and accurately returns the Default printer. However when remotely connecting in with WMI, it always returns false.

I thought it could depend on the user with which you did the remote WMI query. Howeve开发者_StackOverflow中文版r, that's not the case (I tried it with different users and no change).

Is there anyway to fix this? I'm currently trying to get this to work on a Windows 7 client and i'm connecting to it from a Windows 2008 R2


I can see that this thread is quite old but I thought I'd add my 2 cents worth even if though it's of no help, but this same issue is there with XP too. In fact under XP you can't read the Win32_CDROMDrive stuff either, although it's fixed under Windows 7.

Have you found an answer to the default printer issue with WMI? As an alternative you can read the default printer but not the port from the registry as in: hkcu\software\microsoft\windows NT\CurrentVersion\Windows\Device

It'll show something like HP Color LaserJet CP3525 PCL6,winspool,Ne03: Trim the crap and you've got what you need. Now you've got the printer you can get the matching port via WMI.

Regards,

4Eyes

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号