Set-PrintersMarkedForMigration
SYNOPSIS
Configure a device to connect to a selected printer on a specified print server and remove existing shared printers.
SYNTAX
Set-PrintersMarkedForMigration [-PrintersToReplace] <String[]> [-TargetPrinter] <String>
[-TargetPrintServer] <String> [[-Logfile] <String>] [[-OptionalPrinterToAdd] <String>]
[[-OptionalPrinterToReplace] <String>] [<CommonParameters>]
DESCRIPTION
This function connects a device to a specified printer on a target print server and removes currently configured shared printers. It creates a backup of the current printer configuration and logs all operations to a specified log file. The function also supports adding or replacing optional printers.
EXAMPLES
EXAMPLE 1
Set-PrintersMarkedForMigration -PrintersToReplace @("OldPrinter1", "OldPrinter2") -TargetPrinter "NewPrinter" -TargetPrintServer "PrintServer01"
Configures the device to connect to "NewPrinter" on "PrintServer01" and removes "OldPrinter1" and "OldPrinter2".
EXAMPLE 2
Set-PrintersMarkedForMigration -PrintersToReplace @("OldPrinter1") -TargetPrinter "NewPrinter" -TargetPrintServer "PrintServer01" -OptionalPrinterToAdd "OptionalPrinter"
Configures the device to connect to "NewPrinter" on "PrintServer01", removes "OldPrinter1", and adds "OptionalPrinter".
EXAMPLE 3
Set-PrintersMarkedForMigration -PrintersToReplace @("OldPrinter1") -TargetPrinter "NewPrinter" -TargetPrintServer "PrintServer01" -Logfile "C:\Logs\MigrationLog.log"
Configures the device to connect to "NewPrinter" on "PrintServer01", removes "OldPrinter1", and writes logs to the specified file.
PARAMETERS
-PrintersToReplace
A list of printers to be replaced during the migration.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-TargetPrinter
The name of the target printer to connect to.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-TargetPrintServer
The name of the target print server hosting the target printer.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Logfile
The path to the log file where operations will be recorded. Defaults to `\\stadgent\dumps\Logs\Printers\\<ComputerName>.log`.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: "\\stadgent\dumps\Logs\Printers\$(Get-Content env:computername).log"
Accept pipeline input: False
Accept wildcard characters: False
-OptionalPrinterToAdd
An optional printer to add during the migration.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-OptionalPrinterToReplace
An optional printer to replace during the migration.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 6
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.