How to set printer permissions using PowerShell / some other script?
Posted
by
Borek
on Super User
See other posts from Super User
or by Borek
Published on 2012-09-24T08:16:40Z
Indexed on
2012/09/24
9:40 UTC
Read the original article
Hit count: 380
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.
© Super User or respective owner