Page 1 of 1 1
Topic Options
#213844 - 2020-03-31 05:11 PM Printer installation script by group
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
All: When I tried to remove the duplicate post, the entire thread was removed. Here's the original content:

By eltonfaturetto on 03/27/2020
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.

===========================================================

By ShaneEP on 03/30/2020
DelPrinterConnection is one of the functions that use the 'Printer Name' as opposed to the share name. If the printer name is different than the share name, try changing it to the printer name and see if that resolves the issue. Also, you don't need to enclose the function in an IF block if you're not going to use the condition for anything.

If you are only doing to suppress output, then you can also do it like so...

$nul = DELPRINTERCONNECTION ("\\192.168.1.1\PrinterName")

===========================================================

By eltonfaturetto on 03/31/2020
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.
_________________________
Actually I am a Rocket Scientist! \:D

Top
#213845 - 2020-03-31 05:14 PM Re: Printer installation script by group [Re: Glenn Barnas]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Try:
 Code:
If InGroup('groupname')
  If AddPrinterConnection('\\server\share') = 0
    'Added printer' ?
  EndIf
EndIf
_________________________
Actually I am a Rocket Scientist! \:D

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 507 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.048 seconds in which 0.022 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org