Start-CleanupPrinter
SYNOPSIS
Remove a printer that is no longer in service from print servers.
SYNTAX
Start-CleanupPrinter [-PrinterName] <String[]> [[-Servers] <String[]>] [-WhatIf] [-Confirm]
[<CommonParameters>]
DESCRIPTION
This function removes a printer from the specified print servers. It checks if the printer exists on one or more servers and, if found, performs the following actions: - Removes the printer share. - Deletes the printer. - Removes the port if it is no longer used by other printers.
EXAMPLES
EXAMPLE 1
Removes "Printer1" from the default server `srvprint01`.
EXAMPLE 2
Removes "Printer1" from the servers `srvprint01` and `srvprint02`.
PARAMETERS
-PrinterName
The name of the printer(s) to be removed.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-Servers
A list of print servers to check and remove the printer from. Defaults to `srvprint01`.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: @('srvprint01')
Accept pipeline input: False
Accept wildcard characters: False
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.