Link to home
Start Free TrialLog in
Avatar of RyanMyers83
RyanMyers83

asked on

Creating a script to re map printers

Hi All,

Our office is conducting a move with many hundreds of users from one location within a building to another and I have been tasked with coming up with a script that will remap those users printers so that upon logging in the following morning and running the logon script they will attach to the appropriate printers.  

At this time I would like to break down for you how our current environment is setup:

We have three buildings on site and within each building there are designated printers in which everyone within that building will map to.  There are also many freestanding network printers that users map to as is necessary.  Within Active Directory we have security groups created which (assuming the user is a part of that group) in turn run a vb script that installs printers for those users.

Below is a small part of our logon script to Illustrate:

:NEXT
\\CRP*****.*****.LOCAL\NETLOGON\IFMEMBER "*******Local\CRP-secBld300"
IF NOT errorlevel 1 GOTO NEXT
\\crp*****\netlogon\BLD300printers.vbs


Below is the corresponding VB script that runs if user is a part of said Security Group

ON ERROR RESUME NEXT
 
Set objPrinters = WScript.CreateObject("WScript.Network")
Set objShell = WScript.CreateObject("WScript.Shell")
 
'Remove old printers
objPrinters.RemovePrinterConnection "\\crp******\3-141-Xerox4260c"
 
'Install new Printers
objPrinters.AddWindowsPrinterConnection "\\crp******\3-141-Xerox5225c"



'Clean Up Memory Used
set objShell = Nothing
Set objPrinters = Nothing
 
wscript.quit



With that said I was hoping to gain some assistance with creating a new script that determines if a user is connected to a certain printer (rather than Security Group) and if so deletes that printer and remaps a new printer in it's place.  The many users who are moving are not part of any one constant Security Group and therefore makes it difficult for me to modify the current scripts we have in place to automatically map the printers for the users.  

What I am hoping to do is have a script in place that will check the users accounts for certain connected printers that I know will be a part of the move and upon determining the user is connected to that printer, delete the printer and re-connect to the printers new location.  I plan on implementing the new Logon script the day following the move.

If anyone has any idea's on how to accomplish this task it would be much appreciated.  I'm also open to new idea's as well.










ASKER CERTIFIED SOLUTION
Avatar of Vaidas911
Vaidas911
Flag of Lithuania image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RyanMyers83
RyanMyers83

ASKER

Hi Viadas911,

I appreciate the comment however that script assumes we know which printers the user is going to get.  We also have some printers on site that only certain users have access to such as payroll or HR related.  I know where the printers will be located but I don't know who has connected to what printer other than the main printers on each floor.  I was hoping to craft a script that would compare the users installed printers to a list of printers in the move and, if matched, deletes the matched printers and re-connects the new *moved* printers.  This would ensure that the users printers that had moved along with the user had remapped correctly.