- Windows Server 2016 Automation with PowerShell Cookbook(Second Edition)
- Thomas Lee
- 125字
- 2021-07-02 18:16:01
How it works...
In step 1, you use New-Object to get the security principal details for the Sales Group from the Active Directory. In step 2, you use this object's Translate method to retrieve the SID for the group.
In step 3, you define the SDDL that is used to set permissions. In this step, as a sanity check, you can see the information you use to set the DACL. The output looks like this:
In step 5, you get the printer object for the Sales Group printer, and in step 6, you update the printer with the SDDL string you created in step 3. That sets the Sales Group printer's DACL. You can verify the results by rerunning the Reporting on printer security recipe.