I have a script that outputs all printers on a print server into a text file then queries each printer in that list to get the permissions on that printer, I am having an issue getting the permissions split so that they are separated by printer name and receiving a quota error so I am wondering how to query say the first 250 then the next set as well as outputting the data so that the permissions are under the proper printer name, below is the error, the script and what my list looks like.
function Convert-SDDLToACL {
[CmdletBinding()]
Param (
[string[]]$SDDLString
)
foreach ($SDDL in $SDDLString) {
$ACLObject = New-Object -Type Security.AccessControl.DirectorySecurity
$ACLObject.SetSecurityDescriptorSddlForm($SDDL)
$ACLObject.Access
}
}
# Creates Printer List
$computerfile = 'MPLSPS01'
foreach ($computer in $computerfile) {
Get-WmiObject Win32_Printer -ComputerName $computer |
Select-Object Name |
Out-File C:\Users\stephen.lyons.sa\Desktop\test\tes4.txt
}
# Gets print server list
$obj = Get-Content C:\Users\stephen.lyons.sa\Desktop\test\test4.txt |
Select-Object name
# Allows more than 100 printers to be queried
$ra = @(0..100)
# Returns ACE values into readable format
foreach ($object in $obj) {
$object
$sddl = (Get-Printer $obj -Full).PermissionSDDL
Convert-SDDLToACL $sddl |
Select-Object -Expand IdentityReference |
Select-Object -Expand Value
}