Skip to content

Remove-BulkPrinterShares

SYNOPSIS

Remove printer shares from the print server `srvprint01`.

SYNTAX

Remove-BulkPrinterShares [-printerlist] <String[]> [[-shared] <Boolean>] [[-onlydead] <Boolean>] [-WhatIf]
 [-Confirm] [<CommonParameters>]

DESCRIPTION

This function searches for a list of printers on the print server and removes their shares, making them inaccessible. The printers themselves remain intact. It also provides options to re-share the printers or remove shares only for offline printers.

EXAMPLES

EXAMPLE 1

Remove-BulkPrinterShares -PrinterList @('Printer1', 'Printer2') -Shared $false

Removes the shares for the specified printers on the print server.

EXAMPLE 2

Remove-BulkPrinterShares -PrinterList @('Printer1') -OnlyDead $true

Removes the share for the specified printer only if it is offline.

PARAMETERS

-printerlist

A list of printers to process. Provide a string array in the form @('printer1', 'printer2', ...).

Type: String[]
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-shared

Indicates whether the printer should be shared. Defaults to `$false`. Set to `$true` to re-share the printer (reverse action).

Type: Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-onlydead

Removes shares only for printers that are offline.

Type: Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: False
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.

INPUTS

OUTPUTS

NOTES