List of Print drivers on clients

(imported topic written by emock91)

We are rebuilding our print server. Is there a way Bigfix can look for Print drivers on workstations … 32 and 64 bit ?

Thank you …

(imported comment written by gjeremia91)

looking for the driver as a file? Do you know the file names ?

You can also try looking in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print"

values “Printer Driver” of keys whose (exists value “Printer Driver” of it) of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\printers” of registry

(imported comment written by MattBoyd)

here’s another way that should work for 32/64 bit:

string values of selects 
"name from win32_printerdriver" of wmi

(imported comment written by emock91)

That should work … Thank you …

Is there a was to find what the default printer selected is on a work station ? I tried this , but it grabs the 1st printer it see’s . Not the default printer …

(if property “Default” of it as string contains “True” then property “Name” of it as string else nothing) of select objects (“Name, Default from win32_Printer”) of wmi

(imported comment written by MattBoyd)

I would try checking for default in the WMI query instead. Like this:

string values of selects 
"Name from win32_printer where Default = true" of wmi

It should only return the name of 1 printer.

(imported comment written by gjeremia91)

someone else can comment on the wmi version, but for the registry check, you would look in HKCU or HKU

e.g.

unique values 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)

takes about 1.7 ms on my machine.

(imported comment written by emock91)

Thank you for the help. Both properties show the default printer if you run the relevance on the workstation . But the problem is that most machines show Microsoft XPF document printer or writer.

(imported comment written by Shlomi91)

Hi,

Printer defaults are profile-specific.

When running the property against a remote computer, you should run it as current user.

(imported comment written by emock91)

Yes , Correct … How do we get the attached property ?

(imported comment written by JLaFo91)

value “Device” of key “HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows” of registry

This is the key that we want the value of. In the relavence debugger it reports the correct information. However when we run the relavence on the network, we get everything but the default printer. It appears to find the lowest Ne # (Ne00 or Ne 01). Is there a problem with Big Fix seeing the HKEY_CURRENT_USER data? Or is it hanging up on the printer’s netwrok port(s).

(imported comment written by gjeremia91)

the relevance I provided looks at ALL the users, i.e. gives you the default for all users. HKCU registry key is really a mapping of the presently logged in HKU<user> tree. That can be obtained a few ways. One easy way is: ‘component string of sid of current user’

So comes down to, do you want to know the default priter drivers for all users, or jsut the currently logged in user?

What about systems where the user is not logged in?

(imported comment written by JLaFo91)

The printer for current logon user.

(imported comment written by SystemAdmin)

Question,

Can an example be provided to show

(1) The printer for the current logon user (Querying the HKEY\current_user)

(2) If there are multiple printers, How can you query for a specific printer?

(imported comment written by JLaFo91)

We are looking for there current DEFAULT printer for the current logged on user!

(imported comment written by JackCoates91)

gjeremia’s approach looks promising, but as you saw LocalSystem can’t see into HKCU. You may have to separate asking the question from retrieving the answer.

task: use a vbscript to query the registry key or the wmi key boyd gave you, then use runascurrentuser.exe to execute it and write to file. schedule to only run when a user is logged in.

analysis: parse the file.

(imported comment written by jgstew)

This is related:

http://bigfix.me/analysis/details/2994741