PowerShell script that retrieves the LDAP settings for printers

hannes-wolf-n2ILm0aTCYo-unsplash

Here is a sample PowerShell script that retrieves the LDAP settings for printers:

$printers = Get-Printer -Name "PrinterName"

foreach($printer in $printers) {
    $printerPort = $printer.PortName
    $printerDriver = $printer.DriverName
    
    $printerConfig = Get-PrinterProperty -Name $printer.Name -Key "ldapSettings"
    $ldapServer = $printerConfig.ldapServer
    $ldapPort = $printerConfig.ldapPort
    $ldapSearchBase = $printerConfig.ldapSearchBase
    
    Write-Host "Printer: $($printer.Name)"
    Write-Host "Port: $($printerPort)"
    Write-Host "Driver: $($printerDriver)"
    Write-Host "LDAP Server: $($ldapServer)"
    Write-Host "LDAP Port: $($ldapPort)"
    Write-Host "LDAP Search Base: $($ldapSearchBase)"
} 

This script retrieves the printers with the specified name and then loops through each printer to retrieve its port name, driver name, and LDAP settings. The Get-PrinterProperty cmdlet is used to retrieve the LDAP settings for each printer. The script then displays the retrieved information using the Write-Host cmdlet.

You can modify the script to fit your specific needs, such as adding more printer properties or filtering the printers by location or type.


Font size: +
Report Print
 

By accepting you will be accessing a service provided by a third-party external to https://www.klokur.com/