Passer au contenu principal

Remove-Printer

Supprime une imprimante de l'ordinateur spécifié.

Syntaxe

Remove-Printer
      [-Name] <String[]>
      [-ComputerName <String>]
      [-CimSession <CimSession[]>]
      [-ThrottleLimit <Int32>]
      [-AsJob]
      [-PassThru]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Remove-Printer
      -InputObject <CimInstance[]>
      [-CimSession <CimSession[]>]
      [-ThrottleLimit <Int32>]
      [-AsJob]
      [-PassThru]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

La cmdlet Remove-Printer supprime une imprimante de l'ordinateur spécifié. Vous pouvez spécifier l'imprimante à supprimer en utilisant soit un objet d'imprimante récupéré par Get-Printer, soit en spécifiant un nom d'imprimante.

Vous pouvez utiliser des caractères génériques avec Remove-Printer. Vous pouvez utiliser Remove-Printer dans une session à distance Windows PowerShell.

Vous n'avez pas besoin d'informations d'identification d'administrateur pour exécuter Remove-Printer.

Exemples

Exemple 1: Supprimer une imprimante spécifique

Remove-Printer -Name "Microsoft XPS Document Writer"

Cette commande supprime l'imprimante nommée Microsoft XPS Document Writer de l'ordinateur local.

Exemple 2: Supprimer une imprimante spécifique à l'aide d'un objet d'imprimante

$Printer = Get-Printer -Name "Microsoft XPS Document Writer"
Remove-Printer -InputObject $Printer

La première commande obtient l'imprimante nommée Microsoft XPS Document Writer à l'aide de l'applet de commande Get-Printer. La commande stocke le résultat dans la variable $Printer.

La deuxième commande supprime l'imprimante dans $Printer.