Question : How would I script the adding of a network printer to an XP client based on the the Computer's name?

I would like to script the addition of network printers to a user's profile based on the computer name.

I have 2 buildings and each has its own print server.
The names of the print server has one letter difference, that letter signifies building..
 i.e Nprint1 for north building and Sprint1 for south building.

Client computer names use a similar naming convention.  The first character of the computer's name signifies building.  *(Again N for North, S for South)  

The next set of characters are a 3 digit numeric string that is equivalent to the room number that the machine is located in. The last string is a 2 digit number which is just based on the number of computers in the room.  For example in the North Building room 221 we have 45 computers which would be named N22101 through N22145.

Printers have been named using a similar convention.  A printer in the North Building room 221 would have the name N221PTR1 and if there were multiple printers the last number would just be incremented depending on how many printers there were.
          Using the same example for room 221 in the North building we might have 6 print queues and their names would be N221PTR1, N221PTR2, N221PTR3, N221PTR4, N221PTR5 & N221PTR6

Since we have a pretty straight forward naming convention and are already testing for the computer name and installing the printers, it should be fairly easy to alter the script I have to test the computer string name and based on the building signfier (N or S) point it to the correct print server.
then based on the room number part of the computer name add all of the printers that have been created on that server with that room number in their name using a loop to go through all of the queues found in that room.  I say I guess it should be fairly easy, but I haven't been able to figure out how to do it yet.  Hopefully one of you gurus who does scripting a lot more than me will be able to do it relatively easily.

I have attached an existing script example that we use.  but the way it currenty works we need to maintain 2 scripts (one for each building)  plus we need to edit the script everytime a new printer is added to a room and everytime a new room with computers and printers is added to the domain.

Again, I'm looking for help altering the existing script so that it uses the computer name (which in the existing script uses the variable strComputer) and then uses the correct Print server for the building, and then loops through all of the printers in a given room adding all of them to the client computer, and making the first one the default. For example N221PTR1 would be the default printer for all of the computers in room 221 in the North building.

I reallize this may have gotten a little confusing but please ask if you need more detail and I will be happy to try to clarify.

Thanks
Attachments:
 
Here is a copy of an existing script file that we currently use
 

Answer : How would I script the adding of a network printer to an XP client based on the the Computer's name?

Just go to

Start
Control Panel
Network and Sharing Center
and on the Left Side Changer adapter settings.

Then right click the wireless adapter and select disable.
Random Solutions  
 
programming4us programming4us