PowerShell script to list installed printers on a list of computers


I need a PS script that can list all installed printers using a list of computers. Something like what this script does but for more than 1 computer:
Get-WmiObject -class Win32_printer| ft name, systemName, shareName >> C:\result.txt

  • Alright, so the next example I have added a Test-Connection cmdlet in there to first ping the system before attempting to establish a wmi connection. Have a look at the results by running this code:

    Get-Content -Path ListOfComputers.txt | ForEach-Object {
    if (Test-Connection $_ -Count 1 -Quiet) {
    Get-WmiObject -class Win32_printer -computername $_ | ft name, systemName, shareName >> C:\result.txt
    } else {
    "Computer $_ offline" >> c:\result.txt
Reply Children
No Data