I'm running the following script to get a report on installed printers :
https://community.spiceworks.com/scripts/show/2186-export-printer-information-to-spreadsheet?page=1
However when the script is working it scans for the 64 bit driver retrieves it, copy's to the excel output and then scans for the 32 bit and overwrites the original 64bit.
I have tried unsuccessfully to come up with a solution :
# Get printer information
ForEach ($PrintServer in $PrintServers)
{ Write-Verbose "$(Get-Date): Working on $PrintServer..."
$Printers = Get-WmiObject Win32_Printer -ComputerName $PrintServer
ForEach ($Printer in $Printers)
{
If ($Printer.Name -notlike "Microsoft XPS*")
{
$Drivers = Get-WmiObject Win32_PrinterDriver -Filter "__path like '%$($Printer.DriverName)%'" -ComputerName $Printserver
ForEach ($Driver in $Drivers)
{ $Drive = $Driver.DriverPath.Substring(0,1)
$Sheet.Cells.Item($intRow, 1) = $PrintServer $Sheet.Cells.Item($intRow, 2) = $Printer.Name
$Sheet.Cells.Item($intRow, 3) = $Printer.Location
$Sheet.Cells.Item($intRow, 4) = $Printer.Comment
If ($Printer.PortName -notlike "*\*")
{ $Ports = Get-WmiObject Win32_TcpIpPrinterPort -Filter "name = '$($Printer.Portname)'" -ComputerName $Printserver
ForEach ($Port in $Ports)
{
$Sheet.Cells.Item($intRow, 5) = $Port.HostAddress
}
}
$Sheet.Cells.Item($intRow, 6) = $Printer.DriverName
$Sheet.Cells.Item($intRow, 7) = (Get-ItemProperty ($Driver.DriverPath.Replace("$Drive`:","\\$PrintServer\$Drive`$"))).VersionInfo.ProductVersion
$Sheet.Cells.Item($intRow, 8) = Split-Path $Driver.DriverPath -Leaf
$Sheet.Cells.Item($intRow, 9) = $Printer.Shared
$Sheet.Cells.Item($intRow, 10) = $Printer.ShareName
$Sheet.Cells.Item($intRow, 11) = Split-Path
$Driver.SupportedPlatform -Leaf
$intRow ++
}
**************************
This fails,can someone suggest how to retrieve the 64bit driver also and pipe it into the spreadsheet.