Check out this
module. After importing it, check to see if the following command gives you the same SDDL that setPrinter64.exe was giving you:
Get-SecurityDescriptor -Path \\servername -ObjectType Printer | select -ExpandProperty Sddl
If that matches, you might be in luck. Things are going to get a little wierd, though, since this wasn't a use case I envisioned for the module. The Set-SecurityDescriptor function doesn't take an -ObjectType parameter (yet), which means you can't call it
the same way you called Get-SecurityDescriptor. That's on my list of things to do for the next version, though. In the meantime, you should be able to do something like this as a workaround (and to any future readers, if the module is past version 2.1, the
following workaround shouldn't be necessary anymore; see the help for ways to copy SDs from one object to another):
$Sd = Get-SecurityDescriptor -Path \\servername -ObjectType Printer
$Sd.SdPath = "\\otherservername"
$Sd | Set-SecurityDescriptor -WhatIf
Set-SecurityDescriptor will inspect the object being passed to it and use the path and object type from there. You shouldn't have to manually modify the SdPath property, but in this case it lets you get around the fact that we can't force Set-Security to use
a certain path and object type. If you take the -WhatIf parameter off, you'll be prompted before making any changes. To suppress that prompt, you'll need to use the -Force switch.
One more thing: if you try to view or modify the security descriptor ACLs, a lot of the access masks are going to be numeric. That's due to the fact that the printer rights enumeration was created without server rights included. That's something else that
I'll fix in a future release. You can still add and remove entries with the module, but you might have to use numeric rights. Let me know if I'm rambling and not making any sense :)
If you end up using this, obviously you'll want to make sure you've manually stepped through this on a few systems and confirmed (maybe using the GUI or SetPrinter64.exe) that the SD was copied properly before trying to automate it.
If you have any questions or problems, please let me know.