Cài đặt máy in Ricoh MP5054

  Tran Anh Group

Bước 1: Tìm kiếm powershell ISE và mở bằng Administrator

Bước 2: Copy đoạn code dưới đây và dán vào PowerShell ISE

if ((Get-Printer -Name "3F_Printer_01" -ErrorAction SilentlyContinue).Name -ne $null)
{
    Write-Host "May in da duoc cai."
    return
}


# Get the driver file. Select the first, in case there are more
$inf = Get-ChildItem -Path "\\10.3.1.202\vpcc\Setup\Driver\Printer\RicohMP" -Recurse -Filter "*.inf" |
    Where-Object Name -NotLike "Autorun.inf" |
    Select-Object -First 1 |
    Select-Object -ExpandProperty FullName
# Check that the inf file is the one you're looking for
Write-Host "The inf file is '$inf'" -ForegroundColor Cyan
# Install the driver
PNPUtil.exe /add-driver $inf /install
# Retrieve driver info
$DismInfo = Dism.exe /online /Get-DriverInfo /driver:$inf
$DismInfo | Select-String -Pattern "Description" 
# Retrieve the printer driver name
$DriverName = "RICOH MP 5054 PCL 6"
#( $DismInfo | Select-String -Pattern "Description" | Select-Object -Last 1 ) -split " : " |
#    Select-Object -Last 1
# Add driver to the list of available printers
Add-PrinterDriver -Name $DriverName -Verbose
# Add local printer port (SilentlyContinue skips without errors in case the port name already exists)
Add-PrinterPort -Name "LocalPort:" -ErrorAction SilentlyContinue -Verbose
# Add a network printer port
Add-PrinterPort -Name "TCPPort:10.3.1.121" -PrinterHostAddress "10.3.1.121" -ErrorAction SilentlyContinue
#Add the printer
Add-Printer -DriverName $DriverName -Name "3F_Printer_01" -PortName "TCPPort:10.3.1.121" -Verbose
Set-PrintConfiguration -PrinterName "3F_Printer_01" -PaperSize A4
$Printer = Get-CimInstance -Class Win32_Printer -Filter "Name='3F_Printer_01'"
Invoke-CimMethod -InputObject $Printer -MethodName SetDefaultPrinter 
exit

Bước 3: Ấn Enter để cài đặt

Bước 4: Nếu không có lỗi gì thì có thể dùng máy in có tên là 3F_Printer_01

LEAVE A COMMENT