Set default printer by port or by wildcard name


i need set default printer on large number of computers , need simple command line can ran on of them it.  the similarities between printers use same port , there common word in name.

this i've tried , neither have worked:

rundll32 printui.dll,printuientry /y /n "*name*"

rundll32 printui.dll,printuientry /y /n "%name%"

rundll32 printui.dll,printuientry /y /r "port"

cscript %windir%\system32\printing_admin_scripts\en-us\prnmngr.vbs -t -r "port"

cscript %windir%\system32\printing_admin_scripts\en-us\prnmngr.vbs -t -p "*name*"

cscript %windir%\system32\printing_admin_scripts\en-us\prnmngr.vbs -t -p "*name*"

any appreciated.

prncommkey = "some common name text here" strcomputer = "." set objwmiservice = getobject("winmgmts:\\" & strcomputer & "\root\cimv2") set colprinters = objwmiservice.execquery("select * win32_printer name '%"&prncommkey&"%'") each objprinter in colprinters     wscript.echo "found:" & objprinter.name 	objprinter.setdefaultprinter() next



Windows Server  >  Print/Fax



Comments

Popular posts from this blog

Azure MFA with Azure AD and RDS

WIMMount (HSM) causing cluster storage to go redirected (2012r2 DC)

Failed to delete the test record dcdiag-test-record in zone test.com