Skip to content

Instantly share code, notes, and snippets.

@peruihkxt
Last active June 17, 2020 02:15
Show Gist options
  • Save peruihkxt/3a0d6f5cd0e6b0826fdfccc62db81be1 to your computer and use it in GitHub Desktop.
Save peruihkxt/3a0d6f5cd0e6b0826fdfccc62db81be1 to your computer and use it in GitHub Desktop.
# License: MIT
# Do whatever you want to with this.
function DownloadAndExtract([string]$url) {
$savedProgressPreference = $ProgressPreference
$ProgressPreference = [System.Management.Automation.ActionPreference]::SilentlyContinue
$filename = [io.path]::GetFileName($url)
$outputDirectory = [io.path]::Combine($pwd, [System.IO.Path]::GetFileNameWithoutExtension($filename))
Invoke-WebRequest $url -UseBasicParsing -OutFile $filename
Write-Verbose ((& 7z "x" "$filename" "-aoa" "-o$outputDirectory") | out-string)
$ProgressPreference = $savedProgressPreference
return $outputDirectory
}
function Get-Driver($directory, $match) {
Get-ChildItem -path $directory -Recurse *.inf |
ForEach-Object {
Get-WindowsDriver -Online -Driver $_.FullName | Where-Object {$_.Architecture -eq 9 -and ($_.HardwareDescription -match $match)}
} |
Sort-Object -Property Version |
Select-Object -Last 1
}
# Use this to see what drivers match a query.
function Get-Drivers($directory, $match) {
Get-ChildItem -path $directory -Recurse *.inf |
ForEach-Object {
Get-WindowsDriver -Online -Driver $_.FullName | Where-Object {$_.Architecture -eq 9 -and ($_.HardwareDescription -match $match)}
} | Sort-Object -Property Version
}
function Install-Driver($infPath) {
& "$env:windir\system32\pnputil.exe" /add-driver "$infPath" /install
}
###########################################################################################
# Sato Links: http://www.satoworldwide.com/software/gallerydriver.aspx #
# Old Printers: http://www.satoworldwide.com/software/gallerydriver/gallerydriver-v5.aspx #
###########################################################################################
# Sato CL 408 (Legacy Driver)
$dir = DownloadAndExtract 'https://www.satoworldwide.com/sites/satoworldwide_com/Uploads/Files/Downloads/GalleryDriver/4.6.69/SI_PREV_4669_3621.zip'
$driver = Get-Driver $dir -match 'CL 408'
Install-Driver $driver.OriginalFileName
Add-PrinterDriver -Name $driver.HardwareDescription
# Sato GL 408e
$dir = DownloadAndExtract 'https://www.satoworldwide.com/sites/satoworldwide_com/Uploads/Files/Downloads/GalleryDriver/6.0.16/SATO_6016_8371.zip'
$driver = Get-Driver $dir -match 'GL408e'
Install-Driver $driver.OriginalFileName
Add-PrinterDriver -Name $driver.HardwareDescription
# Sato CL 408e
$dir = DownloadAndExtract 'https://www.satoworldwide.com/sites/satoworldwide_com/Uploads/Files/Downloads/GalleryDriver/6.0.16/SATO_6016_8371.zip'
$driver = Get-Driver $dir -match 'CL408e'
Install-Driver $driver.OriginalFileName
Add-PrinterDriver -Name $driver.HardwareDescription
# M84-Pro 200dpi
$dir = DownloadAndExtract 'https://www.satoworldwide.com/sites/satoworldwide_com/Uploads/Files/Downloads/GalleryDriver/7.8.07_16488/SATO_7807_16488.zip'
$driver = Get-Driver $dir -match 'M84 Pro 200DPI'
Install-Driver $driver.OriginalFileName
Add-PrinterDriver -Name $driver.HardwareDescription
# M84-Pro 300dpi
$dir = DownloadAndExtract 'https://www.satoworldwide.com/sites/satoworldwide_com/Uploads/Files/Downloads/GalleryDriver/7.8.07_16488/SATO_7807_16488.zip'
$driver = Get-Driver $dir -match 'M84 Pro 300DPI'
Install-Driver $driver.OriginalFileName
Add-PrinterDriver -Name $driver.HardwareDescription
# Brother HL-L5100
$dir = DownloadAndExtract 'https://download.brother.com/welcome/dlf102379/Y15B_C1-hostm-220.EXE'
$driver = Get-Driver $dir -match '5100'
Install-Driver $driver.OriginalFileName
Add-PrinterDriver -Name $driver.HardwareDescription
# Brother HL-L5200
$dir = DownloadAndExtract 'https://download.brother.com/welcome/dlf102379/Y15B_C1-hostm-220.EXE'
$driver = Get-Driver $dir -match '5200'
Install-Driver $driver.OriginalFileName
Add-PrinterDriver -Name $driver.HardwareDescription
# Brother HL-2270DW
$dir = DownloadAndExtract 'https://download.brother.com/welcome/dlf005137/Y10D_C1-gdi-64-win8-109.EXE'
$driver = Get-Driver $dir -match '2270'
Install-Driver $driver.OriginalFileName
Add-PrinterDriver -Name $driver.HardwareDescription
# Brother HL-3170
$dir = DownloadAndExtract 'https://download.brother.com/welcome/dlf005144/Y12E_C1-hostm-1150.EXE'
$driver = Get-Driver $dir -match '3170'
Install-Driver $driver.OriginalFileName
Add-PrinterDriver -Name $driver.HardwareDescription
# Brother HL-L2740
$dir = DownloadAndExtract 'https://download.brother.com/welcome/dlf101000/Y14B_C1-hostm-D1.EXE'
$driver = Get-Driver $dir -match '2740'
Install-Driver $driver.OriginalFileName
Add-PrinterDriver -Name $driver.HardwareDescription
# Brother MFC-7460DN
$dir = DownloadAndExtract 'https://download.brother.com/welcome/dlf004579/Y10E_C1-gdi-64-D2.EXE'
$driver = Get-Driver $dir -match '7460DN Printer'
Install-Driver $driver.OriginalFileName
Add-PrinterDriver -Name $driver.HardwareDescription
# Brother MFC-L2740
$dir = DownloadAndExtract 'https://download.brother.com/welcome/dlf101000/Y14B_C1-hostm-D1.EXE'
$driver = Get-Driver $dir -match '2740'
Install-Driver $driver.OriginalFileName
Add-PrinterDriver -Name $driver.HardwareDescription
# Brother MFC-L3750 CDW
$dir = DownloadAndExtract 'https://download.brother.com/welcome/dlf103872/Y17E_C1-hostm-D1.EXE'
$driver = Get-Driver $dir -match '3750'
Install-Driver $driver.OriginalFileName
Add-PrinterDriver -Name $driver.HardwareDescription
# Brother PT-D600
$dir = DownloadAndExtract 'https://download.brother.com/welcome/dlfp100119/bspd60w110bus.exe'
$driver = Get-Driver $dir -match 'D600'
Install-Driver $driver.OriginalFileName
Add-PrinterDriver -Name $driver.HardwareDescription
# Canon MF4350D
$dir = DownloadAndExtract 'https://gdlp01.c-wss.com/gds/5/0100001495/05/MF4350MFDriversV270W64usEN.exe'
$driver = Get-Driver $dir -match 'Canon MF4320-4350$' # The `$` is necessary so it doesn't match the Fax driver.
Install-Driver $driver.OriginalFileName
Add-PrinterDriver -Name $driver.HardwareDescription
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment