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
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
IF INGROUP ("imp_FORMIM01")
ADDPRINTERCONNECTION ("\\ infrati03 \ FORMIM01")
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?
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 ...."
I think the group part is missing.
If InGroup('groupname') If AddPrinterConnection('\\server\share') = 0 'Added printer' ? EndIf EndIf