How to set printer permissions using PowerShell / some other script?
- by Borek
I need to update printer's permissions in a script, i.e. do the same as I would manually do this way:
Open Devices and Printers applet
Double-click the default printer (open its queue)
Go to Printer - Properties
In the properties dialog, go to Security tab
Change permissions for Everyone (e.g., check Manage documents permissions)
How to do that? For example, in PowerShell, I can do
Get-WmiObject -class win32_printer -filter Default=True
to get the default printer and there are then methods getSecurityDescriptor() and setSecurityDescriptor() but for instance this command:
(Get-WmiObject -class win32_printer -filter Default=True).getsecuritydescriptor().Descriptor
return null so I'm not sure if I'm doing it the right way.
Does anyone have a working example to set printer permissions? Am I on the right path or should I use something other than WMI entirely? Thanks.