Intune/Powershell/Drucker/MFC-8860.ps1
2025-04-21 16:08:06 +02:00

28 lines
939 B
PowerShell
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

$PrinterName = "Brother-MFC-8860DN-Vertrieb"
$PrinterIP = "192.168.150.211"
$PortName = "IP_$PrinterIP"
# Prüfen, ob der Drucker bereits existiert
if (-not (Get-Printer -Name $PrinterName -ErrorAction SilentlyContinue)) {
# TCP/IP-Port prüfen und ggf. hinzufügen
if (-not (Get-PrinterPort -Name $PortName -ErrorAction SilentlyContinue)) {
Add-PrinterPort -Name $PortName -PrinterHostAddress $PrinterIP
Write-Host "TCP/IP Port hinzugefügt: $PortName"
} else {
Write-Host "TCP/IP Port existiert bereits."
}
# Drucker hinzufügen ohne konkreten Treiber, Windows sucht automatisch
try {
Add-Printer -Name $PrinterName -PortName $PortName
Write-Host "Drucker hinzugefügt: $PrinterName (Treiber automatisch ausgewählt)"
}
catch {
Write-Host "Fehler beim Hinzufügen des Druckers: $_"
}
} else {
Write-Host "Drucker ist bereits installiert."
}