Hi All,
We are migrating to a new print server, and i am writing a script to detect a users installed printers, change the server name and re add the printers (and also set the default printer). This is to be deployed from SCCM 2012 R2
The problem is that the deployment runs but doesn't migrate any of the printers - when run manually, the script asks for drivers to be installed for certain printers.
Is there a way to bypass this in pwershell?
I have already tried to get around the problem in SCCM but it hasnt worked.
My Script is below.
Thanks in advance for your help :)
$net = New-Object -ComObject WScript.Network
$oldqueues = Get-WmiObject -Class Win32_Printer | Where-Object ServerName -Like '\\ukhem02001*' | select Name -ExpandProperty Name
$default = Get-WmiObject -Class Win32_Printer | Where-Object Default -EQ 'True'| select Name -ExpandProperty Name
$default = $default.Replace("oldprintserver","newprintserver")
foreach ($queue in $oldqueues){
$path = $queue.Replace("oldprintserver","newprintserver")
$net.AddWindowsPrinterConnection("$path")
$net.RemovePrinterConnection("$queue")
}
$net.SetDefaultPrinter("$default")
Adding printer from print server
January 30th, 2014 9:56am
You should be using PrintManager to migrate printers. It is part of the Server set and needs to be used because it will manage all printers in an AD domain correctly. SCCM is only useful when you are running a pre-WS2008 domain.
Free Windows Admin Tool Kit Click here and download it now
January 30th, 2014 12:13pm