#213840 - 2020-03-27 01:02 PM
Printer installation script by group
|
eltonfaturetto
Fresh Scripter
Registered: 2020-03-27
Posts: 5
Loc: Minas Gerais, Brasil, Conceica...
|
Good Morning! Guys see if you can help me:
I have a print server and we are migrating all printers to a new server. I would like to automate this configuration of removing the printer and installing the printer from the new server.
What I have so far but it didn't work was the following:
IF DELPRINTERCONNECTION ("\\ 192.168.1.1 \ FORMIM01") = 0
ENDIF
IF INGROUP ("imp_FORMIM01") ADDPRINTERCONNECTION ("\\ infrati03 \ FORMIM01")
ENDIF
Being: 192.168.1.1 (old server) infrati03 (new server) FORMIM01 (printer share name) imp_FORMIM01 (AD group of the printer where I will play all users.
|
Top
|
|
|
|
#213843 - 2020-03-31 04:57 PM
Re: Printer installation script by group
[Re: ShaneEP]
|
eltonfaturetto
Fresh Scripter
Registered: 2020-03-27
Posts: 5
Loc: Minas Gerais, Brasil, Conceica...
|
Sorry, I'm a layman on the subject and maybe I can't express myself more correctly. To delete the printer I managed to solve.
Now, I need to map the printers for users according to their groups. I have groups created in AD for printer, for installation I wanted to add the user in the group so that the printer is mapped. Is that possible?
Example: Informatics industry AD group created for printer: imp_FORMIM01 (I added this group in the printer security on the print server) Print server: INFRATI03 Printer Group: imp_FORMIM01 Printer name: Suppliers - Ricoh SP 377 SFNwX
What I have so far and it didn't work was the following:
IF ADDPRINTERCONNECTION ("\\ INFRATI03 \ FORMIM01") = 0 ? "ADDED PRINTER CONNECTION ...." ENDIF
I think the group part is missing.
|
Top
|
|
|
|
#213846 - 2020-03-31 05:57 PM
Re: Printer installation script by group
[Re: eltonfaturetto]
|
eltonfaturetto
Fresh Scripter
Registered: 2020-03-27
Posts: 5
Loc: Minas Gerais, Brasil, Conceica...
|
Friend, nothing happens, put the script as you referred me and it didn't work:
If InGroup ("imp_FORMIM01") If AddPrinterConnection ("\\INFRATI03\FORMIM01") = 0 'Added printer' ? EndIf EndIf
This is my complete script, is something missing?: ;Script de Login para Usina Santo Angelo Ltda SETCONSOLE("HIDE") Shell "Net time \\vmdc01 /set /yes"
USE "*" /DELETE USE P: "\\vmfs01\Usuarios2\"+@userid USE J: "\\vmfs01\Grupos2\sap" USE N: "\\vmfs01\Grupos2\NeP" USE T: "\\vmfs01\Publico"
IF (@userid <> "Pedro") IF INGROUP ( "Agricola" ) = 1 USE K: \\192.168.3.155\ImpSAP /USER:xxxxx\ImpSAP /PASSWORD:xxxxxx ENDIF ENDIF
IF (@userid <> "Pedro") IF INGROUP ( "Controle Biologico" ) = 1 USE G: "\\vmfs01\Grupos2\Controle Biologico" ENDIF ENDIF
IF (@userid = "cguidi") USE H: "\\PHBKP01\Grupos2\Juridico" ENDIF
IF (@userid = "Pedro") USE Y: "\\vmfs01\Grupos2\Controle Biologico" ENDIF
IF INGROUP ( "Controle Biologico" ) = 1 USE G: "\\vmfs01\Grupos2\Controle Biologico" ENDIF
IF INGROUP ( "GEOTEC" ) = 1 USE G: "\\vmfs01\Grupos2\Informatica\GEOTEC" ENDIF
IF INGROUP ( "Armazem Gerais" ) = 1 USE g: "\\vmfs01\Grupos2\Armazem Gerais" ENDIF
IF INGROUP ( "Informatica" ) = 1 USE g: "\\vmfs01\Grupos2\informatica" ENDIF
IF INGROUP ( "InfraTELECOM" ) = 1 USE g: "\\vmfs01\Grupos2\Informatica\InfraTELECOM" ENDIF
IF INGROUP ( "Agricola" ) = 1 USE g: "\\vmfs01\Grupos2\Agricola" ENDIF IF INGROUP ( "MEP" ) = 1 USE g: "\\vmfs01\Grupos2\MEP" ENDIF IF INGROUP ( "Juridico" ) = 1 USE g: "\\vmfs01\Grupos2\Juridico" ENDIF
IF (@userid = "Irineu") USE k: \\192.168.3.155\ImpSAP /USER:xxxxx\ImpSAP /PASSWORD:xxxxx ENDIF
IF INGROUP ( "InfraestruturaCB" ) = 1 USE G: "\\vmfs01\Grupos2\informatica\CB" ENDIF
IF INGROUP ( "Instrumentacao" ) = 1 USE G: "\\vmfs01\Grupos2\Instrumentacao" ENDIF
IF INGROUP ( "Balanca" ) = 1 USE g: "\\vmfs01\Grupos2\Balanca" ENDIF
IF INGROUP ( "Contabilidade" ) = 1 USE G: "\\vmfs01\Grupos2\Contabilidade" ENDIF
IF INGROUP ( "Financeiro" ) = 1 USE g: "\\vmfs01\Grupos2\Financeiro" ENDIF
IF INGROUP ( "PCM" ) = 1 USE g: "\\vmfs01\Grupos2\PCM" ENDIF
IF INGROUP ( "Compras" ) = 1 USE g: "\\vmfs01\Grupos2\Compras" ENDIF
IF INGROUP ( "AlmoxarifadoIndustrial" ) = 1 USE g: "\\vmfs01\Grupos2\Almoxarifadoindustrial"
ENDIF
IF INGROUP ( "MecanicaIndustrial" ) = 1 USE g: "\\vmfs01\Grupos2\MecanicaIndustrial"
ENDIF
IF INGROUP ( "RHumanos" ) = 1 USE g: "\\vmfs01\Grupos2\RHumanos" ENDIF
IF INGROUP ( "DptPessoal" ) = 1 USE g: "\\vmfs01\Grupos2\DptPessoal" ENDIF
IF INGROUP ( "GerInd" ) = 1 USE g: "\\vmfs01\Grupos2\gerind" ENDIF
IF INGROUP ( "Destilaria" ) = 1 USE g: "\\vmfs01\Grupos2\Destilaria" ENDIF
IF INGROUP ( "Bancadas" ) = 1 USE g: "\\vmfs01\Grupos2\Bancadas" ENDIF
IF INGROUP ( "LaboratorioIndustrial" ) = 1 USE g: "\\vmfs01\Grupos2\LabIndustrial" ENDIF
IF INGROUP ( "GAIndustrial" ) = 1 USE g: "\\vmfs01\Grupos2\GAIndustrial" ENDIF
IF INGROUP ( "FaturamentoVendas" ) = 1 USE g: "\\vmfs01\Grupos2\FaturamentoVendas" ENDIF
IF INGROUP ( "GLIndustrial" ) = 1 USE g: "\\vmfs01\Grupos2\GLIndustrial" ENDIF
IF INGROUP ( "OMAgricola" ) = 1 USE g: "\\vmfs01\Grupos2\OMAgricola" ENDIF
IF INGROUP ( "Instrumentacao" ) = 1 USE g: "\\vmfs01\Grupos2\Instrumentacao" ENDIF
IF INGROUP ( "engenharia" ) = 1 USE g: "\\vmfs01\Grupos2\engenharia" ENDIF
IF INGROUP ( "AlmoxarifadoCMP" ) = 1 USE G: "\\vmfs01\Grupos2\AlmoxarifadoCMP" ENDIF
IF INGROUP ( "AdministracaoCMP" ) = 1 USE G: "\\vmfs01\Grupos2\AdministracaoCMP" ENDIF IF INGROUP ( "SegurancaTrabalho" ) = 1 USE G: "\\vmfs01\Grupos2\SegurancaTrabalho" ENDIF
IF INGROUP ( "SegurancaTrabalhoAgricola" ) = 1 USE G: "\\vmfs01\Grupos2\SegurancaTrabalhoAgricola" ENDIF
IF INGROUP ( "FabricaAcucar" ) = 1 USE G: "\\vmfs01\Grupos2\Fabricaacucar" ENDIF
IF INGROUP ( "ProjetosNR" ) = 1 USE G: "\\vmfs01\Grupos2\ProjetosNR" ENDIF
IF (@userid = "dlopes") USE "*" /DELETE USE G: \\vmfs01\Grupos2\Balanca USE H: \\vmfs01\Grupos2\FaturamentoVendas ENDIF
IF (@userid = "arodrigues") USE "*" /DELETE USE G: \\vmfs01\Grupos2\Balanca USE H: \\vmfs01\Grupos2\FaturamentoVendas USE T: \\vmfs01\Publico ENDIF
IF (@userid = "lamaral") USE "*" /DELETE USE G: \\vmfs01\Grupos2\Balanca USE H: \\vmfs01\Grupos2\FaturamentoVendas USE T: \\vmfs01\Publico ENDIF
IF (@userid = "csumilio") USE "*" /DELETE USE G: \\vmfs01\Grupos2\Balanca USE H: \\vmfs01\Grupos2\FaturamentoVendas USE T: \\vmfs01\Publico ENDIF IF (@userid = "fpaiva") USE "*" /DELETE USE G: \\vmfs01\Grupos2\Contabilidade USE H: \\vmfs01\Grupos2\Financeiro ENDIF IF (@userid = "ttristao") USE "*" /DELETE USE G: \\vmfs01\Grupos2\Contabilidade USE H: \\vmfs01\Grupos2\Financeiro USE T: \\vmfs01\Publico ENDIF IF (@userid = "lmaria") USE "*" /DELETE USE G: \\vmfs01\Grupos2\Balanca USE H: \\vmfs01\Grupos2\FaturamentoVendas USE T: \\vmfs01\Publico ENDIF
IF (@userid = "mcorreia") USE "*" /DELETE USE G: \\vmfs01\Grupos2\Balanca USE H: \\vmfs01\Grupos2\FaturamentoVendas USE T: \\vmfs01\Publico ENDIF
IF (@userid = "jsilva") USE "*" /DELETE USE G: \\vmfs01\Grupos2\Balanca USE H: \\vmfs01\Grupos2\FaturamentoVendas ENDIF
IF (@userid = "andersoncolli") USE "*" /DELETE USE G: "\\vmfs01\Grupos2\Contabilidade" USE H: "\\vmfs01\Grupos2\Agricola" USE I: "\\vm01\Grupos2\AlmoxarifadoCMP" USE J: "\\vmfs01\Grupos2\sap" USE N: "\\vmfs01\Grupos2\NeP" USE P: "\\vmfs01\Usuarios2\"+@userid USE T: "\\vmfs01\Publico" ENDIF IF (@userid = "Marcos Rubens") USE "*" /DELETE USE G: "\\vmfs01\Grupos2\Juridico" USE H: "\\vmfs01\Grupos2\Contabilidade" USE J: "\\vmfs01\Grupos2\sap" USE N: "\\vmfs01\Grupos2\NeP" USE P: "\\vmfs01\Usuarios2\"+@userid USE T: "\\vmfs01\Publico" ENDIF
IF DELPRINTERCONNECTION ("\\INFRATI01\FORMIM01") = 0 ? "DELETED PRINTER CONNECTION...." ENDIF IF DELPRINTERCONNECTION ("\\192.168.1.1\FORMIM01") = 0 ? "DELETED PRINTER CONNECTION...." ENDIF
If InGroup ("imp_FORMIM01") If AddPrinterConnection ("\\INFRATI03\FORMIM01") = 0 'Added printer' ? EndIf EndIf
IF (@producttype = "Windows XP Professional") OR (@producttype = "Windows 2000 Professional") RUN "gpupdate /force" ENDIF
exit
|
Top
|
|
|
|
#213847 - 2020-03-31 08:09 PM
(NA) Re: Printer installation script by group
[Re: eltonfaturetto]
|
ShaneEP
MM club member
Registered: 2002-11-29
Posts: 2125
Loc: Tulsa, OK
|
If you remove the group check portion, does it then map the printer?
If AddPrinterConnection("\\INFRATI03\FORMIM01") = 0
'Added printer' ?
EndIf
|
Top
|
|
|
|
#213848 - 2020-03-31 08:32 PM
(NA) Re: Printer installation script by group
[Re: ShaneEP]
|
eltonfaturetto
Fresh Scripter
Registered: 2020-03-27
Posts: 5
Loc: Minas Gerais, Brasil, Conceica...
|
Yes the printer is mapped. But as I have several printers, if I only do printer sharing, all printers for all users will be installed.
So I have the need to install by groups of AD.
|
Top
|
|
|
|
#213849 - 2020-04-17 08:41 PM
Re: (NA) Re: Printer installation script by group
[Re: eltonfaturetto]
|
NTDOC
Administrator
Registered: 2000-07-28
Posts: 11623
Loc: CA
|
Please see the other topic post from Glenn Barnas
If InGroup('groupname')
If AddPrinterConnection('\\server\share') = 0
'Added printer' ?
EndIf
EndIf
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 259 anonymous users online.
|
|
|