Has anyone found a successful “default Printer” property for the current logged in user (that they wouldn’t mind sharing)? We have tried several variations and they seem to come back with the same generic type default printer (Microsoft XPS). The WMI checks come back with the proper default printer when checking in QnA on the local system - but not the proper value when put in a TEM property. I understand the “current logged in user” attributes - and do get results - but they seem to still give the generic printers and not the current user default printer. The last one we tried was:
((values “Device” of keys “windows” whose ( exists values “Device” of it ) of keys “Software\Microsoft\Windows NT\CurrentVersion” of keys of key “HKEY_USERS” of registry) as string)
if exists value “Device” of key “HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows” of registry then value “Device” of key “HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows” of registry as string else “no default printer”
If you are looking for more detail like Duplex, Portname, servername, sharename… etc… please email me, we have a script that needs to run to gather the data… from WMI. It’s not pretty, but works.
Just looking for basic default printer for current logged in user.
We are getting back mixed results when doing a local query or through the console. The actual registry value has the proper “default” printer - however, the result coming back in the console is not the same. Is this because of the “logged on user” versus “system service” querying?
if exists value “Device” of key “HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows” of registry then value “Device” of key “HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows” of registry as string else “no default printer”
This does not seem to be exactly what you want, but this is what I use to pull back the default printers across all users, excluding certain non-physical printers.
concatenation ", " of (unique values whose(it as string does not contain “Microsoft” AND it as string does not contain “PDF” AND it as string as lowercase does not contain “fax” AND it as string does not contain “OneNote” AND it as string does not contain “PaperPort”) of preceding texts of firsts “,” of ((values “Device” of keys “windows” whose ( exists values “Device” of it ) of keys “Software\Microsoft\Windows NT\CurrentVersion” of keys of key “HKEY_USERS” of registry) as string) as string)