May 072013
 

This PowerShell script uses Dism to find all OEM entries and then parses them into a text file. Run as administrator.

###########################################################################
#
# Get-Drivers.ps1
#
# Use Dism to create a list of OEM driver entries. This can also be 
# changed to output other entries as well. Run as administrator.
#
# by Robert Hollingshead
# Contributed to the public domain. Do with it what you will. 
#
###########################################################################

$fileStream = [System.IO.StreamWriter] "C:\Drivers.txt"

[array]$arrayDismParsed = @()

$arrayDismParsed = "Parsed output from Get-Drivers.ps1"

# Populate the array. 
$arrayDismOutput = & dism /online /get-drivers /all /format:table

$arrayDismParsed = $arrayDismParsed + $arrayDismOutput[11]
$arrayDismParsed = $arrayDismParsed + $arrayDismOutput[12]
$arrayDismParsed = $arrayDismParsed + $arrayDismOutput[13]

for ($arrayPos=0;$arrayPos -le $arrayDismOutput.length;$arrayPos++)
{
    if ($arrayDismOutput[$arrayPos] -like "*OEM*") # Find the OEM entries. ;
    {
        $arrayDismParsed = $arrayDismParsed + $arrayDismOutput[$arrayPos]
    }
}

for ($arrayPos=0;$arrayPos -le $arrayDismParsed.length;$arrayPos++)
{
    $fileStream.WriteLine($arrayDismParsed[$arrayPos])
}

$fileStream.Close()
May 072013
 

This script will take a list of print servers and then query each individual server on the list for the installed print drivers. It will then output a report in csv format of all drivers encountered.

###########################################################################
#
# Query listed print servers and report on all drivers discovered.  
#
# by Robert Hollingshead
# Contributed to the public domain. Do with it what you will. 
#
###########################################################################

# Place your server list CSV file here, including path. 
$ServerCSV = "{output csv and path}"

# Place the output CSV file here, including path. 
$OutputCSV = "{output csv and path}"

#Change nothing below this line. 

$credential = Get-Credential
$driver = ""
[system.array]$report = $null

$servers = Import-Csv $ServerCSV

foreach ($server in $servers) 
{

    Write-Host ' ' 
    Write-Host $server.Servername -NoNewLine

    $drivers = Get-WMIObject -class Win32_PrinterDriver -computer $server.Servername -credential $credential

    foreach($driver in $drivers) 
    {

        Write-Host "." -NoNewLine

        $path = $driver.DriverPath.Substring(0,1)

        $output = New-Object PSObject
        $output | Add-Member -membertype noteproperty -Name Servername -Value $server.Servername
        $output | Add-Member -membertype noteproperty -Name Drivername -Value $driver.Name

        $servername = $server.Servername

        $output | Add-Member -membertype noteproperty -Name Driverversion -Value (Get-ItemProperty ($driver.DriverPath.Replace("$path`:","\\$servername\$path`$"))).VersionInfo.ProductVersion

        $report = $report + $output

    }

}

$report | export-csv $OutputCSV -notype
May 072013
 

The following PowerShell script will delete drivers from the driver store that match a keyword. It will also ignore a specific driver if need be. Use to prune older sets of drivers that are no longer needed. Use at your own risk, of course.

###########################################################################
#
# Use pnputil to delete drivers (in this case Xerox) from the driver store. 
#
# by Robert Hollingshead
# Contributed to the public domain. Do with it what you will. 
#
###########################################################################

# Populate the array. 
$arrayPnpOutput = & pnputil -e

for ($arrayPos=0;$arrayPos -le $arrayPnpOutput.length;$arrayPos++)
{
    if ($arrayPnpOutput[$arrayPos] -like "*Xerox") # Find matches for xerox as the publisher. ;
    {
        if ($arrayPnpOutput[$arrayPos+2] -notlike "*11/23/2011 5246.700*") # Do not kill this version..
        {
            $arrayPnpOutput[$arrayPos-1] = $arrayPnpOutput[$arrayPos-1] -replace "Published name :            ",""
            Write-Host "Erasing: " $arrayPnpOutput[$arrayPos-1]
            pnputil -d $arrayPnpOutput[$arrayPos-1]
        }
    }
}