Tags: Print Server · Windows Server 2025 · Impressão · Drivers · Type 4 · PrintNightmare

Por Duarte Spínola · 4 de Julho de 2026

Print Server no Windows Server 2025: Configurar e Resolver Problemas em 2026

O Print Server continua a ser uma função essencial em PMEs com impressoras partilhadas, multifuncionais e plotters. O Windows Server 2025 trouxe melhorias na gestão de drivers, suporte para Type 4 drivers e protecção contra a vulnerabilidade PrintNightmare. Este guia cobre instalação, configuração, drivers, segurança e resolução de problemas, com base na documentação oficial Microsoft.

Para complementar, consulta os artigos sobre Windows Admin Center, Windows Server 2025, PowerShell 7, Corrigir Windows Update e Registar e Documentar Tickets.

Conteúdos

1. Instalar a Função Print Server

# Instalar a função Print Server via PowerShell
Install-WindowsFeature -Name Print-Services -IncludeManagementTools

# Verificar instalação
Get-WindowsFeature -Name Print-Services

# Reiniciar se necessário
# Restart-Computer -Force

# Verificar serviço Print Spooler
Get-Service -Name Spooler | Select-Object Name, Status, StartType

# A função instala:
# - Print Spooler service
# - Print Management Console
# - PowerShell print management module

2. Adicionar Impressoras e Drivers

# Adicionar driver de impressão
Add-PrinterDriver -Name "HP Universal Printing PCL 6" -ComputerName printserver01

# Adicionar porta TCP/IP para impressora de rede
Add-PrinterPort -Name "IP_192.168.1.50" -PrinterHostAddress "192.168.1.50"

# Adicionar impressora partilhada
Add-Printer -Name "HP-LaserJet-Andar1" `
  -DriverName "HP Universal Printing PCL 6" `
  -PortName "IP_192.168.1.50" `
  -ShareName "HP-LaserJet-Andar1" `
  -Published $true  # Publica no AD

# Verificar impressoras instaladas
Get-Printer | Select-Object Name, DriverName, PortName, Shared, Published

# Verificar portas
Get-PrinterPort | Select-Object Name, PrinterHostAddress

# Verificar drivers
Get-PrinterDriver | Select-Object Name, PrinterEnvironment, DriverVersion

3. Drivers Type 4 vs Type 3

A Microsoft introduziu os Type 4 drivers no Windows 8 / Server 2012. São mais isolados, não precisam de processos de instalação e são mais seguros. No entanto, muitos fabricantes continuam a fornecer apenas Type 3.

Característica Type 3 (V3) Type 4 (V4)
Isolamento de processo Parcial Total (sandboxed)
Instalação no cliente Copia ficheiros Sem cópia (usa driver do servidor)
PrintNightmare Vulnerável (se não patched) Imune
Configurações avançadas Sim (UI completa) Limitada (constraints)
Compatibilidade Todos os fabricantes Fabricantes modernos
Recomendado Se Type 4 não disponível Sim (prioridade)

💡 Dica: No Windows Server 2025, o suporte Type 4 é a prioridade. Sempre que possível, usa drivers Type 4 do fabricante. Se o fabricante não fornecer Type 4, usa o driver universal (HP Universal, Xerox Global, Canon Generic) em modo Type 4.

4. Deploy de Impressoras via GPO

# Deploy de impressoras via GPO (Group Policy)

# 1. No GPMC (Group Policy Management Console):
# Computer Configuration > Policies > Windows Settings >
# Deployed Printers > Add Printer

# OU via User Configuration:
# User Configuration > Preferences > Control Panel Settings > Printers

# 2. Para deploy por grupo de segurança:
# User Configuration > Preferences > Control Panel Settings > Printers
# - New > Shared Printer
# - Path: \\printserver01\HP-LaserJet-Andar1
# - Item-level targeting: Security Group = "Andar 1 Users"

# 3. Para deploy por OU (computador):
# Computer Configuration > Preferences > Control Panel Settings > Printers
# - New > TCP/IP Printer
# - IP: 192.168.1.50
# - Driver: "HP Universal Printing PCL 6"
# - Item-level targeting: OU = "Computadores Andar 1"

# Via PowerShell (deploy remoto):
# Instalar impressora num computador remoto
Invoke-Command -ComputerName WS-001 -ScriptBlock {
    Add-Printer -ConnectionName "\\printserver01\HP-LaserJet-Andar1"
}

# Verificar impressoras instaladas num computador remoto
Invoke-Command -ComputerName WS-001 -ScriptBlock {
    Get-Printer | Select-Object Name, Shared, Published
}

5. Gerir Impressoras com PowerShell

# Listar todas as impressoras do servidor
Get-Printer -ComputerName printserver01 | Format-Table Name, DriverName, PortName, Shared -AutoSize

# Listar todas as impressoras de todos os clientes
Get-ADComputer -Filter {OperatingSystem -like "*Windows 11*"} | ForEach-Object {
    $printers = Get-Printer -ComputerName $_.Name -ErrorAction SilentlyContinue
    if ($printers) {
        [PSCustomObject]@{
            Computer = $_.Name
            Count = $printers.Count
            Names = ($printers.Name -join ", ")
        }
    }
} | Format-Table -AutoSize

# Renomear impressora
Rename-Printer -Name "HP-LaserJet-Andar1" -NewName "HP-LJ-Andar1-Recepcao"

# Definir impressora padrão num cliente
Invoke-Command -ComputerName WS-001 -ScriptBlock {
    Set-Printer -Name "HP-LJ-Andar1-Recepcao" -Default $true
}

# Remover impressora
Remove-Printer -Name "HP-LaserJet-Velho"

# Limpar fila de impressão
Get-PrintJob -PrinterName "HP-LJ-Andar1-Recepcao" | Remove-PrintJob

# Verificar estado da fila
Get-PrintJob -PrinterName "HP-LJ-Andar1-Recepcao" | Select-Object Id, DocumentName, JobStatus, TotalPages

6. PrintNightmare: Proteger o Servidor

O PrintNightmare (CVE-2021-34527) é uma vulnerabilidade crítica que permite execução remota de código através do Print Spooler. Mesmo com patches, há medidas adicionais recomendadas.

⚠ Aviso Crítico: Nunca instales o Print Server num Controlador de Domínio. O Print Spooler em DCs é um vector de escalação de privilégios. Usa um servidor membro dedicado.

# Protecções contra PrintNightmare

# 1. Verificar se o patch está instalado
Get-HotFix | Where-Object { $_.HotFixID -like "*KB500*"} | Select-Object HotFixID, InstalledOn

# 2. Restringir who can install printer drivers via GPO
# Computer Configuration > Administrative Templates > Printers >
# "Restrict driver installation to administrators" = Enabled

# 3. Verificar registry key de protecção
Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PointAndPrint" `
  -ErrorAction SilentlyContinue

# Deve ter:
#   RestrictDriverInstallationToAdministrators = 1

# 4. desativar PointAndPrint se não necessário
# GPO: Computer Configuration > Administrative Templates > Printers >
# "Point and Print Restrictions" = Enabled
#   - Users can only point and print to these servers: printserver01.empresa.pt
#   - Security Prompts: Do not show warning or elevation prompt

# 5. Verificar que o Spooler não está em DCs
Get-ADDomainController | ForEach-Object {
    $spooler = Get-Service -Name Spooler -ComputerName $_.HostName
    [PSCustomObject]@{
        DC = $_.HostName
        SpoolerStatus = $spooler.Status
        StartType = $spooler.StartType
    }
} | Format-Table

# Se o Spooler estiver ativo em DCs e não for necessário:
# Invoke-Command -ComputerName dc01 -ScriptBlock {
#     Stop-Service -Name Spooler -Force
#     Set-Service -Name Spooler -StartupType Disabled
# }

7. Problemas de Spooler

# Reiniciar Print Spooler
Restart-Service -Name Spooler -Force

# Limpar ficheiros de spool pendurados
Stop-Service -Name Spooler -Force
Remove-Item -Path "C:\Windows\System32\spool\PRINTERS\*.*" -Force -Recurse
Start-Service -Name Spooler

# Verificar eventos do Spooler
Get-WinEvent -LogName "Microsoft-Windows-PrintService/Operational" -MaxEvents 20 |
  Select-Object TimeCreated, Id, LevelDisplayName, Message |
  Format-Table -Wrap

# Verificar se há ficheiros pendurados
Get-ChildItem "C:\Windows\System32\spool\PRINTERS" | Measure-Object | Select-Object Count

# Problemas comuns de Spooler:
# 1. Ficheiros .SHD e .SPL pendurados -> limpar directoria PRINTERS
# 2. Driver incompatível -> remover driver problemático
# 3. Porta TCP/IP errada -> recriar porta
# 4. Serviço crashed -> reiniciar
# 5. Memória insuficiente -> verificar RAM do servidor

8. Drivers em Controlador de Domínio

O problema clássico: quando promoves um servidor com Print Server a Controlador de Domínio, os drivers Type 3 deixam de funcionar correctamente porque o erro “Fail to print on Server when promoted to DC” (documentado pela Microsoft).

# Verificar se o servidor é DC
$role = (Get-WmiObject Win32_ComputerSystem).DomainRole
# 0 = Standalone, 1 = Member, 4 = Backup DC, 5 = Primary DC

if ($role -ge 4) {
    Write-Warning "Este servidor é um DC. Print Server em DC NÃO é recomendado."
    Write-Warning "Drivers Type 3 podem falhar. Migrar para servidor membro."
}

# Se já tens Print Server em DC e precisas de migrar:
# 1. Instalar Print Server num servidor membro
# 2. Exportar impressoras do DC
Export-Printer -ComputerName dc01 -FileName "C:\Temp\printers.xml"

# 3. Importar no novo servidor
Import-Printer -ComputerName printserver01 -FileName "C:\Temp\printers.xml"

# 4. atualizar GPO para apontar para novo servidor
# 5. Desativar Print Spooler no DC

9. Impressoras de Rede vs Partilhadas

Aspecto Impressora Partilhada Impressora de Rede
Conexão Via servidor (\\server\printer) Directa TCP/IP
Driver No servidor No cliente
Gestão centralizada Sim Não
Auditoria Sim (no servidor) Limitada
Deploy via GPO Sim Sim (TCP/IP)
Load no servidor Sim Não

10. Monitorizar e Auditar Impressões

# ativar auditoria de impressão
# 1. No Print Management Console:
#    Print Servers > printserver01 > Properties > Security tab
#    - ativar "Audit object access" para Success

# 2. Via GPO:
# Computer Configuration > Policies > Windows Settings > Security Settings >
# Advanced Audit Policy > Object Access > Audit File System = Success

# 3. Verificar eventos de impressão
Get-WinEvent -LogName "Microsoft-Windows-PrintService/Operational" |
  Where-Object { $_.Id -eq 307 } |
  Select-Object TimeCreated,
    @{N="User";E={$_.Properties[2].Value}},
    @{N="Printer";E={$_.Properties[3].Value}},
    @{N="Document";E={$_.Properties[4].Value}},
    @{N="Pages";E={$_.Properties[6].Value}} |
  Format-Table -AutoSize

# 4. Relatório de impressões por utilizador (últimos 30 dias)
$events = Get-WinEvent -LogName "Microsoft-Windows-PrintService/Operational" -MaxEvents 10000 |
  Where-Object { $_.Id -eq 307 }

$events | ForEach-Object {
    [PSCustomObject]@{
        Date = $_.TimeCreated
        User = $_.Properties[2].Value
        Printer = $_.Properties[3].Value
        Pages = $_.Properties[6].Value
    }
} | Group-Object User |
  Select-Object Name, @{N="TotalPages";E={($_.Group | Measure-Object Pages -Sum).Sum}} |
  Sort-Object TotalPages -Descending |
  Format-Table -AutoSize

11. Drivers Universais (Vendor)

Fabricante Driver Universal Type 4?
HP HP Universal Printing PCL 6 / PS Sim (v7+)
Xerox Xerox Global Print Driver Sim
Canon Canon Generic Plus UFR II Sim
Brother Brother Universal Printer Driver Parcial
Ricoh Ricoh PCL6 Universal Driver Sim

💡 Dica: Usa sempre drivers universais do fabricante em vez de drivers específicos por modelo. Reduz o número de drivers no servidor, simplifica a gestão e garante compatibilidade entre modelos diferentes.

12. Cenário Prático PME

Para uma PME com 30 utilizadores e 5 impressoras (2 andares + 1 multifuncional + 2 plotters):

# 1. Servidor: Windows Server 2025 (membro, NÃO DC)
# 2. Driver: HP Universal Printing PCL 6 (Type 4) para todas as HP
# 3. Driver: Canon Generic Plus para multifuncional Canon

# Deploy:
# - Andar 1: HP-LJ-Andar1 (GPO por security group "Andar1")
# - Andar 2: HP-LJ-Andar2 (GPO por security group "Andar2")
# - Multifuncional: Canon-MF-Recepcao (GPO para todos)
# - Plotter 1: HP-Plotter-Eng (GPO por security group "Engenharia")
# - Plotter 2: HP-Plotter-Arq (GPO por security group "Arquitetura")

# Grupos AD:
#   SG-Print-Andar1
#   SG-Print-Andar2
#   SG-Print-Engenharia
#   SG-Print-Arquitetura

# GPO:
#   GPO-PrintDeploy
#     User Configuration > Preferences > Printers
#     Item-level targeting por security group

13. Problemas Comuns e Soluções

Problema Causa Solução
Driver não instala no cliente Type 3 + PointAndPrint restrito Migrar para Type 4 ou permitir install para admins
Spooler crasha frequentemente Driver incompatível ou memória Remover driver problemático, reiniciar Spooler
Impressora não imprime Porta TCP/IP errada ou offline Verificar IP, recriar porta, ping
Driver falha em DC Print Server em DC (não suportado) Migrar Print Server para servidor membro
Fila de impressão pendurada Ficheiros .SHD/.SPL pendurados Parar Spooler, limpar PRINTERS, reiniciar
Lentidão ao imprimir Driver Type 3 com UI pesada Migrar para Type 4 ou driver universal

14. Checklist de Implementação

  • ☐ Instalar Print Server em servidor membro (NÃO em DC)
  • ☐ Instalar drivers universais Type 4 (prioridade)
  • ☐ Adicionar portas TCP/IP para cada impressora
  • ☐ Adicionar impressoras partilhadas e publicar no AD
  • ☐ Criar grupos de segurança por localização
  • ☐ Configurar GPO de deploy com item-level targeting
  • ☐ ativar protecções PrintNightmare (RestrictDriverInstallation)
  • ☐ Restringir PointAndPrint ao servidor de impressão
  • ☐ ativar auditoria de impressão
  • ☐ Testar deploy num cliente piloto
  • ☐ Verificar impressão em todos os clientes
  • ☐ Documentar topologia de impressoras
  • ☐ Configurar alertas de Spooler (event 808, 4)
  • ☐ Agendar limpeza mensal de ficheiros de spool

Artigos Relacionados

Baseado na documentação oficial Microsoft sobre Print Services e protecções PrintNightmare. Licença: CC BY-SA 4.0.

← Voltar ao Índice

Este artigo foi útil?

Duarte Spínola

Deixe um Comentário