LRSFC_DanJ Posted November 24, 2022 Posted November 24, 2022 I'm tearing my hair out over this one as it used to work reliably and now doesn't, I've tried 4 different methods of scripting network printer connections but none of them seem to work 100%. I can't use PaperCut Print Deploy because it doesn't support deploying printers based on Active Directory properties of the computer. Same for Group Policy Preferences. I have tried: objNetwork.AddWindowsPrinterConnection \\PRINTSERVERNAME\PRINTQUEUE cscript.exe %windir%\System32\Printing_Admin_Scripts\en-US\prnmngr.vbs -ac -p \\PRINTSERVERNAME\PRINTQUEUE rundll32 printui.dll,PrintUIEntry /in /q /n \\PRINTSERVERNAME\PRINTQUEUE objShell.Run "%SystemRoot%\explorer.exe \\PRINTSERVERNAME\PRINTQUEUE", 0, True Can anyone suggest any other more reliable ways to deploy printers? It's not the PrintNightmare stuff as that would mean it wouldn't work at all, what is happening is it is randomly deploying some of the printers and not others.
tangotech Posted November 24, 2022 Posted November 24, 2022 Why can't you just use GPO?.... Deploying Printers to Domain Users and Computers with GPO | Windows OS Hub
ultimatepie Posted November 24, 2022 Posted November 24, 2022 $printers = Get-Printer -Computername server.local $server = "\\server.local" ForEach ($printer in $printers) { $printermap = $server + $printer.name Invoke-Expression 'rundll32 printui.dll PrintUIEntry /ga /in /q /n $($printermap)' }
LRSFC_DanJ Posted November 24, 2022 Author Posted November 24, 2022 Why can't you just use GPO?.... Deploying Printers to Domain Users and Computers with GPO | Windows OS Hub I don't think it lets me target the printer deployments based on the Location property of the Computer account?
Davit2005 Posted November 24, 2022 Posted November 24, 2022 Use GPP with a shared printer then use loopback processing in a policy covering a OU where the computer that you want to get the printer is. Make sure you select the appropriate mode i.e. Merge or the other one which I cannot remember. What printers are you using by the way. Apologies if you have tried loopback processing already. 1
mdrabble Posted November 24, 2022 Posted November 24, 2022 I use this script by @Katy which works really well and I’ve had no issues with deploying printers since using it. http:// https://katystech.blog/on-prem/powershell-printer-script
LRSFC_DanJ Posted November 25, 2022 Author Posted November 25, 2022 I use this script by @Katy which works really well and I’ve had no issues with deploying printers since using it. https://katystech.blog/on-prem/powershell-printer-script We used to use PowerShell but we can't use it any more since we blocked PowerShell for students.
LRSFC_DanJ Posted November 25, 2022 Author Posted November 25, 2022 In the end I have got it working using the prnmngr.vbs method and then afterwards checking Wscript.Network.EnumPrinterConnections to make sure the printer actually got added.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now